Clear Filters
Clear Filters

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

12 views (last 30 days)
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 ?

Accepted Answer

Roger Stafford
Roger Stafford on 18 Dec 2017
Edited: Roger Stafford on 18 Dec 2017
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.

More Answers (1)

can özbaran
can özbaran on 17 Dec 2017
Edited: Walter Roberson on 17 Dec 2017
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.

Community Treasure Hunt

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

Start Hunting!