我有 3 个向量,其中一个向量的角度为Phi
,另一个角度为Teta
,最后一个是点向量Y axe
,计算完点后Teta
& Phi
有一个功能:
for teta = 0 : 10^-2 : pi/2
for phi = 0 : 10^-2 : pi/2
Y(current) = v*sin(phi)*sin(teta);
Teta(current) = teta;
Phi(current) = phi;
current = current + 1;
end
end
我怎样才能把他们三个放在一起呢?
我想绘制一个3d
图形与Teta
& Phi
作为一个函数Y
。
我尝试过plot3
但结果并不那么令人满意。
Thanks
我不清楚确切的目标,但这是我的解释:
teta = 0:.01:pi/2;
phi =0:.01:pi/2;
[t p]=meshgrid(teta,phi);
Y = v*sin(p)*sin(t);
surf(t,p,Y)
xlabel('teta')
ylabel('phi')
zlabel('1*sin(teta)*sin(phi)')
Create vectors of teta
and phi
values, use meshgrid
to produce a matrix of t and p values, and use the vectorized form of sin
(rather than a for
loop). Then use surf
to plot the results as a surface in 3D.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)