Azzera filtri
Azzera filtri

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

12 visualizzazioni (ultimi 30 giorni)
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 ?

Risposta accettata

Roger Stafford
Roger Stafford il 18 Dic 2017
Modificato: Roger Stafford il 18 Dic 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.

Più risposte (1)

can özbaran
can özbaran il 17 Dic 2017
Modificato: Walter Roberson il 17 Dic 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!

Translated by