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

15 ビュー (過去 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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by