matlab代码为啥显示索引超过数组元素的数量。索引不能超过 1。

L1=54.35;L2=122.78;L3=59.98;L4=108;L5=110.8;L6=98.7;N1=54.35/2;N2=122.78/2;N3=59.98/2;N4=108/2;

P1x=2;P1y=3;P2x=2;P2y=3;P3x=2;P3y=3;P4x=2;P4y=3;

M1=1;M2=1;M3=1;

w1=1;th1=0:0.01:2*pi;

A=2*L1*L4*sin(th1);

B=2*L4*(L1*cos(th1)-L5);

C=L6.^2-L1.^2-L4.^2-L5.^2+2*L1*L5*cos(th1);

D=2*L1*L6*sin(th1);

E=2*L6*(L1*cos(th1)-L5);

F=L1.^2+L6.^2+L5.^2-L4.^2-2*L1*L5*cos(th1);

th2=25.82/180*pi+2*atan((D+sqrt(D.^2+E.^2-F.^2))/(E-F));

th4=2*atan((A+sqrt(A.^2+B.^2-C.^2))/(B-C));

th3=th2+81.21/180*pi;

A = zeros(9,9,size(th1,2));

B = zeros(9,size(th1,2));

for i = 1:size(th1,2)

A(:,:, i) = [1 0 -1 0 0 0 0 0 0; 0 1 0 -1 0 0 0 0 0;0 L2*cos(th2(i))+L3*cos(th3(i)) 0 0 0 0 0 0 0;-1 0 0 0 1 0 0 0 0;0 -1 0 0 0 1 0 0 0;0 0 0 0 L4*sin(th4(i)) -L4*cos(th4(i)) 0 0 0;0 0 1 0 0 0 -1 0 0;0 0 0 1 0 0 0 -1 0;0 0 -L1*sin(th1(i)) L1*cos(th1(i)) 0 0 0 0 1];

B(:,i) = [-P2x;-P2y;P2x*N2*sin(th2(i))+P2y*N2*cos(th2(i))-M2+P3x*(L3-N3)*sin(th3(i))-P3y*(L2*cos(th2(i))+N3*cos(th3(i)));-P4x;-P4y;-P4x*N4*sin(th4(i))-P4y*N4*cos(th4(i))-M3;-P1x;P1y;P1x*N1*sin(th1(i))+P1y*N1*cos(th1(i))-M1];

end

R = zeros(size(th1,2),1);

for i = 1:size(th1,2)

R(i) = linsolve(A(:,:,i),B(:,i));

end

为什么这段代码索引超过数组元素的数量。索引不能超过 1。
 

  • 10
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值