3d plotting help
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!