求助一道matlab坐标系的题目

问题描述:

求助一道matlab坐标系的题目
题目是:Input a non-variable vector in rectangular coordinates and obtain the cylindrical, or spherical components. Must enter the point location where this transformation occurs; the result depends on the vector’s observation point.
大意是说在直角坐标系里给定一个起点不是原点的向量,求其转换成圆柱坐标系和球坐标系的坐标
求大神帮忙!
1个回答 分类:英语 2014-10-04

问题解答:

我来补答
clc;
disp('直角坐标')
a=[3 4 5]
plot3([0 a(1)],[0 a(2)],[0 a(3)]);
text(0,0,0,'O');
text(a(1),a(2),a(3),'P');
disp('柱坐标')
r=norm(a(1:2));
st=acos(a(1)/r);
azhu=[r st a(3)]
disp('球坐标')
r=norm(a);
rxy=norm(a(1:2));
rf=acos(rxy/r);
st=acos(a(1)/rxy);
azhu=[r st a(3)]
再问: 你这个的方法是基于矢量的起点在原点上,而我们老师的要求是起点不是原点,你这个方法有误
 
 
展开全文阅读
剩余:2000