作业帮 > 综合 > 作业

MATLAB Index exceeds matrix dimensions问题

来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/04/29 22:15:50
MATLAB Index exceeds matrix dimensions问题
for i=1:90;
lac=lab*cos(th1)+sqrt(lbc^2-(lab*sin(th1))^2);
l3=sqrt((l1-lac)^2+(l2)^2);
x=(l1-lac)/l2;
y=(l3^2+led^2-lcd^2)/(2*l3*led);
z=l1-lab*cos(th1)-sqrt(lbc^2-(lab*sin(th1)^2));
a=sqrt(z^2-l2^2);
z1=lab*sin(th1)*w1+lab^2*sin(th1)*cos(th1)*w1/(sqrt(lbc^2-(lab*sin(th1)^2)));
x1=(l1+z1)/l2;
y1=4*z*z1*sqrt(z^2-l2^2)-((z^2+l2^2+led^2-lcd^2)*2*z1)/sqrt(z^2-l2^2);
y2=y1/(4*(z^2-l2^2));
z2=-lab^2*sin(th1)*cos(th1)*w1/(2*(lab^2-(lab*sin(th1))^2)^(3/2));
y3=4*z1^2*a+4*z*(z2*a+z1/(2*a))-(2*z*z1*a-(z^2+l2^2+led^2-lcd^2)/(2*a))/(a^2);
y4=(y3*(z^2-l2^2)-2*y1*z*z1)/(4*(a^4));
x2=z2/l2;
th3=atan(x)+pi/2-acos(y);
w3=x1/sqrt(1+x^2)-y2/sqrt(1-y^2);
u=(x2*sqrt(1+x^2)-x*(x1^2)/sqrt(1+x^2))/(1+x^2)-(y4*sqrt(1-y^2)+y*(y2^2)/sqrt(1-y^2))/(1-y^2);
th4=asin((l2-led*sin(th3))/lcd);
F1=(m4*sc)/(lcd*led*u);
F2=(m4*sc)/(lcd*(w3^2)*led);
F3=(m4*sd)/(lcd*u);
F4=(pr*lef*sin(th4)+F1*led*(cos(th3-th4))^2+F2*sin(2*(th3-th4))/2)/(led*(sin(th4)*sin(pi-th3)+cos(th4)*cos(pi-th3)));
F5=(pr*lef-F4*led*sin(pi-th3))/(led*cos(pi-th3));
F6=F5+F1*cos(pi/2+th3)+F2*cos(th3)-F3;
F7=m4*g+F4+F1*sin(pi/2+th3)+F2*sin(th3);
A=m3*u;
F8=F6-A;
F9=F7+m3*g;
B=(m2*sc)/(lbc*u);
E=(m2*sc)/(lbc*(w1^2)*lab);
F10=F8-E*cos(th1)-B;
F11=m2*g+F9-E*sin(th1);
th6=F10*lab*sin(th1)-F11*lab*cos(th1);
th(i,:)=[th1/dr th6/dr];
th1=th1+dth;
end
plot(th(:,1),th(:,6))
Index exceeds matrix dimensions.
Error in ==> dongtai1 at 58
plot(th(:,1),th(:,6))
就是通过各种各样 的换算关系 来画出th1和th6的图像
MATLAB Index exceeds matrix dimensions问题
数组运算要用点乘
再问: 不对啊。。。。还是不出图啊。。。。还是这个问题。。。。。
再答: th(i,:)=[th1/dr th6/dr];说明每行只有2列啊~而你要画的是第一列和第六列啊! 简化问题,th6因为是th1变化而来,用th1代替,dr=2,th1=pi/4随便赋值的,中间计算省略 th1=pi/4; for i=1:90 th(i,:)=[th1/2 th1/2]; th1=th1+0.01; end plot(th(:,1),th(:,6)) 得到workspace里面th是90*2double!!!