MATLAB Matlab: Using imshow and mesh in the same plot

  • Thread starter kellis_115
  • Start date
Hi,
I have written a piece of code to plot a greyscale image using imshow and a mesh plot using mesh in the same plot (the graphs are subplots in the smae figure. My problem is that when I use imshow the meshplot turns to greyscale rather than colour, and I can't worj out how to have one plot as greyscale and the other as colour.

My code is below if this helps;

%Script to show diffraction grating
clear all

M=dlmread('testslit5.txt','\t');

subplot(2,1,1),imshow(M);
title('Diffraction grating');

Mtransform=fft2(M);
Mtransform=fftshift(Mtransform);
N=max(max(Mtransform));
Mtransform=Mtransform/N;

subplot(2,2,3),mesh(abs(Mtransform));
title('Diffraction grating diffraction pattern (intensity)');
subplot(2,2,4),mesh(angle(Mtransform));
title('Diffraction grating diffraction pattern (phase)');

Thanks in advance
 

Want to reply to this thread?

"Matlab: Using imshow and mesh in the same plot" You must log in or register to reply here.

Related Threads for: Matlab: Using imshow and mesh in the same plot

Replies
0
Views
2K
Replies
1
Views
8K
Replies
0
Views
6K
Replies
0
Views
4K
Replies
0
Views
7K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top