Filter löschen
Filter löschen

3d plotting help

1 Ansicht (letzte 30 Tage)
Sean Smith
Sean Smith am 2 Okt. 2011
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 Kommentare
Walter Roberson
Walter Roberson am 2 Okt. 2011
Things are easier with ndgrid() instead of meshgrid()
Sean Smith
Sean Smith am 2 Okt. 2011
i'm still having the same problems with ndgrid()

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Fangjun Jiang
Fangjun Jiang am 3 Okt. 2011
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');

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by