Plot contour in xz and yz plane

조회 수: 13 (최근 30일)
masterfelu
masterfelu 2020년 5월 13일
편집: metrize 2021년 2월 25일
I am trying to plot contours in xy, yz and xz plane simultaneously. The contour is for a surface (Z = f(X,Y)). I made the contour on xy plane but not on any other plane. A similar question was answered but it does not plot the contour in xz or yz plane.
  댓글 수: 3
masterfelu
masterfelu 2020년 5월 13일
No it does not. Here is my output of that macro:
Walter Roberson
Walter Roberson 2020년 5월 13일
You are right, those instructions are only valid up to R2014a.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 5월 13일
Create a hgtransform object inside the axes, say HG. Now call contourf() passing in the hgtransform object, HG, in the first position -- the position for axes. Pass the first independent variables in the first position, the second independent variable in the second position, and the resultant variable in the third position.
Now set the Matrix property of the hgtransform to a rotation matrix that rotates from XYZ coordinates into the axes you want. You may wish to use makehgtform to construct the Matrix property.
If you wish to have additional contours on other planes, repeat the process described.
  댓글 수: 3
Walter Roberson
Walter Roberson 2020년 5월 13일
[Vind1, Vind2, Vresult] = peaks(30);
ax = gca;
HG = hgtransform(ax);
[~, h] = contourf(Vind1, Vind2, Vresult, 'Parent', HG);
HG.Matrix = makehgtform('xrotate', pi/2);
metrize
metrize 2021년 2월 25일
편집: metrize 2021년 2월 25일
@Walter Roberson Hi, I'm having trouble with something similar to this, I'm trying to plot multiple contour plots from inside a for loop and the only way I can move it is with h.ContourZLevel = x; where x is the current value in the for loop, this means i get contour plots stacking in the z axis, but then I cannot view it in the way I want, I need it to be in x,y with the depth as Z, an image is shown: https://i.imgur.com/oCJR73l.png
By doing it this way I can't view it with x,y,depth, but I don't know any other way to plot the contour plots in the for loop without the h.ContourZLevel = x

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by