필터 지우기
필터 지우기

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