Use step size in surf and imagesc

5 views (last 30 days)
Pariz
Pariz on 30 Nov 2015
Answered: Mike Garrity on 30 Nov 2015
I imported a 20 x 20 matrix from a matlab. I used that matrix to plot surface map and image map using surf() and imagesc() as shown below:
figure;
surf(mmx1,'EdgeColor','None', 'facecolor', 'interp');
view(2);
axis equal;
figure;
imagesc(mmx1);
colormap jet;
Although the size of matrix is 20 x 20, the step size is 0.5 mm and hence in the surface and image maps, the X and Y axis should be 10 mm x 10 mm.
Can you please help me to define this step size so that I'd get an image with 10 mm in both X- and Y-axes? Thank you for your help.

Accepted Answer

Mike Garrity
Mike Garrity on 30 Nov 2015
You need to make up XData & YData arrays with the right values and pass them into surf & imagesc. Something like this:
x = linspace(0,10,size(mmx1,2));
y = linspace(0,10,size(mmx1,1));
surf(x,y,mmx1,'EdgeColor','none','FaceColor','interp')
imagesc(x,y,mmx1)

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!