我有兩個相同大小的稀疏矩陣「Matrix1」和「Matrix2」p x n
。在日誌中顯示兩個具有相同顏色條的圖像
通過稀疏矩陣我的意思是它包含大量的零元素。
我想在同一個顏色表和一個唯一的顏色條下顯示兩個矩陣。在MATLAB這樣做很簡單:
bottom = min(min(min(Matrix1)),min(min(Matrix2)));
top = max(max(max(Matrix1)),max(max(Matrix2)));
subplot(1,2,1)
imagesc(Matrix1)
colormap(gray)
caxis manual
caxis([bottom top]);
subplot(1,2,2)
imagesc(Matrix2)
colormap(gray)
caxis manual
caxis([bottom top]);
colorbar;
我的問題:
事實上,當我顯示了使用imagesc(Matrix)
矩陣,它可以忽略總是出現用imagesc(10*log10(Matrix))
的噪音(或背景)。
這就是爲什麼,我想顯示矩陣的10*log10
。但在這種情況下,由於矩陣稀疏,最小值將爲-Inf
。在這種情況下,caxis
將發生錯誤,因爲底部等於-Inf
。
你對我有什麼建議?我如何修改上面的代碼?
任何幫助將不勝感激!
謝謝你的回答:) – Christina
@Christina我的榮幸:)祝你好運! – rayryeng