how can i represent 3d surface(conical surface) by using surface vector function

12 次查看(过去 30 天)
xw=10;
qg=2*pi;
qw=1;
lw=0:pi/12:pi/2;
x=(xw+qw*sin(lw))*cos(qg);
y=(xw+qw*sin(lw))*sin(qg);
z= qw*(1-cos(lw));
hi everyone ,
i want to represent 3d surface by using those vector equations(equation should be represent conical surface) but i couldnt achieve yet. i use "meshgrid" and "surf" command but i couldnt do it.
Can anybody help me with these problem ?

采纳的回答

Roger Stafford
Roger Stafford 2017-12-18
编辑:Roger Stafford 2017-12-18
You should be using the results of meshgrid to calculate Z so that it will be a matrix, not a vector. As near as I can make out, your conical vertex is located at a point (3*cot(pi/5),0,0). Try this:
fic = pi/5;
u = linspace(0,8);
q = linspace(0,2*pi);
[U,Q] = meshgrid(u,q);
X = 3*cot(fic)-(U.*cos(Q))*cos(fic);
Y = (U.*sin(Q))*cos(fic);
Z = U*sin(fic);
surf(X,Y,Z)
I may not have guessed correctly as to your intended cone location, orientation, or angle, but this code should give some pointers about how to obtain the result you desire.

更多回答(1 个)

can özbaran
can özbaran 2017-12-17
编辑:Walter Roberson 2017-12-17
ro=3;
fic=pi/5;
u=linspace(0,8);
Q=linspace(0,pi/2);
x=ro*cot(fic)-u*cos(fic);
y=u*sin(fic).*sin(Q);
[X,Y]=meshgrid(x,y);
Z=u.*sin(fic).*cos(Q);
figure
surf(X,Y,Z)
xlabel('x axis');
ylabel('y axis');
zlabel('z axis');
i changed the formulation and applied into code when i running the code,i am taking an error message like
Z must be a matrix, not a scalar or vector.

类别

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