MATLAB: Plot a complex data

digital image processingimage analysisimage processing

I have been trying to plot a data of magnetic fields obtained from a commercial software. So, far my code is:
[dataBx, dataBy, dataBz]= ReadData(infoFile, gemFile, dataFileBxr, dataFileBxi, dataFileByr, dataFileByi,dataFileBzr, dataFileBzi);
x = (dataBx);
y = (dataBy);
z = (dataBz);
img = (((imag(x) - ((1i)).*(imag(y))/2)));
clims = [min(min(img)) max(max(img))*1E-1];
subplot(2,1,1);
hold all
plot (img)
colormap jet;
subplot(2,1,2);
h_img = imagesc(rms(img));
axis square;
colormap jet;
dataBx, dataBy and dataBz consists of complex numbers which I read in first two line. Then, I stored it in x, y and z respectively. Then, I used the formula: (img=(B1x-B1y)/2). So, here in this code, I represented B1x as x and B1y as y.
Then, I tried to plot it and get the value of magnetic field in colormap values as I obtained from a commercial software. But, I am not able to get that value. I don't know what is wrong here. Can anyone suggest me something? I have tried a lot of things but I am not able to work it out.
May be the formula of clims is wrong.

Best Answer

The call to plot
plot (img)
looks wrong, because img is 2-D. I would expect you to be using image(), imagesc() or imshow() to inspect the array at this point.
The call to imagesc
h_img = imagesc(rms(img));
looks wrong because rms(img) is 1-D. I would expect you to be using plot() at this point, assuming that you do want to see the rms of each column of img (which is what rms() computes).