热线电话:13121318867

登录
2019-02-19 阅读量: 803
标量时间矢量积的可绘制性

我创建了两个函数:frame和t1。第一个(为简单起见,我已经用eye这里替换了某个矩阵)返回三个三维向量。

function [frames] = frame(a1,a2,a3)

L = a1*a2*a3*eye(3);

frames(1,:)= L*([1,0,0])';

frames(2,:)=L*([0,1,0])';

frames(3,:)=L*([0,0,1])';

end

第二个函数将两个标量(B,phi1)和三个向量(通过矩阵Frame)作为输入并返回另一个:

function [t1] = t1(B,Frame,phi1)

ex=Frame(1,:);

ey=Frame(2,:);

ez=Frame(3,:);

t1 = -sin(phi1)*ex - cos(B)*cos(phi1)*ey + cos(phi1)*sin(B)*ez ;

end

当我想要打印或做任何操作与phi1或B为载体,显然我遇到问题,因为像方面sin(phi1)*ex有错误的尺寸而告终。替换它们sin(phi1).*ex也显然是错误的,因为它ex总是具有尺寸3,而sin(phi1)将具有尺寸phi1。

例:

phi1=linspace(0,2*pi);

plot(phi1,t1(pi/2,frame(1,1,1),phi1))

Error using *

Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the

number of rows in the second matrix. To perform elementwise multiplication, use '.*'.

什么是解决这个问题,我在许多其他实例中遇到过?

解决办法:

只需要转置phi1,其余的尺寸都很好。

plot(phi1, t1(pi/2,frame(1,1,1),phi1.'));

产量

0.0000
1
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子