在3D中绘制3个向量

在3D中绘制3个向量

本文介绍了在3D中绘制3个向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个向量,一个是Phi的角度,另一个是Teta的角度,最后一个是Y axe中的点的矢量,在计算了Teta&的点后, Phi具有功能:

I have 3 vectors , one for angles of Phi , another for angles of Teta , and the last one a vector of points in the Y axe ,after computing the points of Teta & Phi with a function :

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

我如何将它们三个一起绘制?

How can I plot the three of them together ?

我想用Teta&绘制3dPhi作为Y的函数.我已经尝试过plot3,但结果并不令人满意.

I want to plot a 3d graph with Teta & Phi as a function of Y .I've tried with plot3 but the result wasn't so satisfactory .

谢谢

推荐答案

我不清楚确切的目标,但这是我的解释:

I'm unclear about the exact goals, but here's my interpretation:

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)')

创建tetaphi值的向量,使用meshgrid生成t和p值的矩阵,并使用sin的矢量化形式(而不是for循环).然后使用surf将结果绘制为3D曲面.

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.

这篇关于在3D中绘制3个向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 20:00