Clear Filters
Clear Filters

rotate figure by transposing matrix in contourf problem

7 views (last 30 days)
Hi: I want to rotate the contour plot by transposing the matrix. but the potted figures are observed to be the same. I'm not sure there is any problem with my code. Could anyone give me some suggestions?
code is below:
load new_X
load new_Y
load new_Z
figure(1)
[xc,yc]=contourf(new_X,new_Y,new_Z);
axis equal
figure(2)
[xc,yc]=contourf(new_X',new_Y',new_Z');
axis equal
Thanks! Yu

Accepted Answer

jonas
jonas on 21 Aug 2018
Edited: jonas on 21 Aug 2018
Transposing every matrix does not change anything. If you throw two matrices X & Y as input, then the coordinates for each Z-value is obtained from those matrices, i.e. Z(1,1) is plotted at [X(1,1) Y(1,1)]. If you transpose each matrix, then the coordinates for each Z remains the same. If you are instead throw only the Z matrix as input to contourf, then transposing it works because the Z-values are plotted against their index, i.e. Z(1,1) is plotted at [1 1].
I suppose this is what you are trying to do:
[xc,yc]=contourf(new_Y,new_X,new_Z);

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!