matlab Matrix must be square. 怎么解决

2024-11-27 21:52:11
推荐回答(3个)
回答1:

改成:

l1=36.15;l2=553.353;l3=400;l4=290;

t=linspace(0,2*pi,100);w=2*pi;

A=l4-l1*cos(w*t);B=-l1*sin(w*t);C=(A.^2+B.^2+l3^2-l4^2)/(2*l3);

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

H=l3*sin(sa3)*2;

plot(t,H); 

输出:

回答2:

> l1=36.15;l2=553.353;l3=400;l4=290;
t=linspace(0,2*pi,100);w=2*pi;
A=l4-l1*cos(w*t);B=-l1*sin(w*t);C=(A.^2+B.^2+l3^2-l4^2)/(2*l3);
sa3=2*atan((B+sqrt(A.^2+B.^2-C.^2))./(A-C));
H=l3*sin(sa3)*2;
plot(t,H);

回答3:

可这样改:
l1=36.15;l2=553.353;l3=400;l4=290;
t=linspace(0,2*pi,100);w=2*pi;
A=l4-l1*cos(w*t);
B=-l1*sin(w*t);
C=(A.^2+B.^2+l3^2-l4^2)/(2*l3);
sa3=2*atan((B+sqrt(A.^2+B.^2-C.^2))./(A-C));
H=l3*sin(sa3)*2;
plot(t,H);