MATLAB Answers


How Can I plot a complex matrix based on a threshold value

Asked by Rahmat Ullah on 11 Jan 2019
Latest activity Edited by Rahmat Ullah on 12 Jan 2019
I have a 100X100 complex double matrix, and I want to plot (surf or imagesc) by mapping values to red that are greater then a threshould (can be any value) and white if less then threshould.


Show 1 older comment
Hi Adam,
Thanks for such a quick responce, actally I am new to matlab , I tried some solutions for both parts of my questions but didnt get what i want.
Like this?
% 100x100 complex double matrix
X = rand(100,100) + 1i*rand(100,100);
% Index of some metric (e.g absolute value) > threshold (e.g 1)
idx = abs(X) > 1;
% Show the result (Red: |X| > 1, White: |X| <= 1)
colormap([1 1 1;1 0 0])

Sign in to comment.

0 Answers