Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I have written a piece of code to plot a greyscale image usingimshowand a mesh plot usingmeshin the same plot (the graphs are subplots in the smae figure. My problem is that when I useimshowthe 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

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab: Using imshow and mesh in the same plot

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads for Matlab Using imshow |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Matlab-like software |

MATLAB Solving equation with integration using MATLAB |

**Physics Forums | Science Articles, Homework Help, Discussion**