필터 지우기
필터 지우기

3d plotting help

조회 수: 1 (최근 30일)
Sean Smith
Sean Smith 2011년 10월 2일
I am trying to plot this figure, an airplane wing but I can't seem to get it oriented right. This is the only way I could get it to plot but I want it facing me, not downward as it is now. So x is the x-axis, y is the z-axis, and z is the y-axis. Every time I change something I get an error. Please help. Thank you.
clear
c=1;
t=0.2;
x=linspace(0,c,100);
l=linspace(0,4,100);
y=t*c/0.2*(0.2969*sqrt(x/c)-0.1260*(x/c)-0.3516*(x/c).^2+0.2843*(x/c).^3-0.1015*(x/c).^4);
[X,Z]=meshgrid(x,l);
surf(X,y,Z);
hold on;
surf(X,-y,Z);
  댓글 수: 2
Walter Roberson
Walter Roberson 2011년 10월 2일
Things are easier with ndgrid() instead of meshgrid()
Sean Smith
Sean Smith 2011년 10월 2일
i'm still having the same problems with ndgrid()

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

채택된 답변

Fangjun Jiang
Fangjun Jiang 2011년 10월 3일
You know the definition of you x, y and z axis. If you want to swap axis, why don't you change the x,y,z symbol in your equation and re-generate the plot.
Or you can use view() to set the viewpoint.
Or you can use the "Rotate 3D" button on the figure to rotate the figure to what you want, and then use the view() to get the viewpoint.
Or I modified your code.
clear
c=1;
t=0.2;
y=linspace(0,c,100);
z=t*c/0.2*(0.2969*sqrt(y/c)-0.1260*(y/c)-0.3516*(y/c).^2+0.2843*(y/c).^3-0.1015*(y/c).^4);
x=y;
[X,Z]=meshgrid(x,z);
surf(x,y,Z);
hold on;
surf(x,y,-Z);
xlabel('x');ylabel('y');zlabel('z');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by