作业帮 > 英语 > 作业

在MATLAB中,提示Attempted to access th(2,1); index out of bounds

来源:学生作业帮 编辑:搜搜考试网作业帮 分类:英语作业 时间:2024/05/02 08:05:44
在MATLAB中,提示Attempted to access th(2,1); index out of bounds because size(th)=[1,2].怎么改?
程序如下:
disp('* * * * * * 飞机起落架机构的运动分析* * * * * *');
dr=pi/180;
L1=input('L1的长度(m)');
L2=input('L2的长度(m)');
L3=input('L3的长度(m)');
L4=input('L4的长度(m)');
th=input('theta_4的值(度)');
th1=[250*dr,260*dr,270*dr,280*dr,290*dr,300*dr,310*dr,320*dr,330*dr,340*dr,350*dr];
for i=1:length(th1)
if th1=270*dr
x1=L1*sin(th1-270*dr);
y1=-L1*cos(th1-270*dr);
x2=L1*sin(th1-270*dr)+L2*cos(th(i,1));
y2=-L1*cos(th1-270*dr)+L2*sin(th(i,1));
x3=L4*cos(th);
y3=L4*sin(th);
(x3-x2).^2+(y3-y2).^2==L3^2;
th(i,2)=(x3-x2)/(y3-y2);
end
end
figure(1)
plot(th1,th(1),'-',th1,th(2),'--');
axis([250 360 -20 120]);
grid
xlabel('cta1 degrees');
ylabel('cta2 cta3 degree cta3 limitation degree');
title('机构位置线图');
text(263.7694,40,'min(cta1)=263.7694');
text(338.5249,40,'max(cta1)=338.5249');
text(290,80,'cta2');
text(290,17,'cta3');
其中L1=0.6,L2=0.65,L3=1.24,L4=1.66,theta—4的值为arctan(5/41).现在结果图中没有曲线是为什么.
在MATLAB中,提示Attempted to access th(2,1); index out of bounds
if th1=270*dr对其他进行运算,使用的显然超过了th的范围啊
(x3-x2).^2+(y3-y2).^2==L3^2;还有这句是什么意思?
再问: 请问,你的意思是,我在th1=270*dr的情况中,超过了350*dr,是么?那句是我想求线段的长度,线段两端点的坐标表达式知道了,用那个式子计算,我想的是它们都是数组,所以后面加了“.”。不知道我想的对不对。。。那怎么改呀?是else的情况变成i>=270*dr&i=270*dr 不能这么写。。。else if才能加判断语句