필터 지우기
필터 지우기

rotate figure by transposing matrix in contourf problem

조회 수: 7 (최근 30일)
Yu Li
Yu Li 2018년 8월 21일
댓글: Yu Li 2018년 8월 21일
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

채택된 답변

jonas
jonas 2018년 8월 21일
편집: jonas 2018년 8월 21일
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);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by