matlab Matrix must be square. 怎么解决

2024年11月27日 21:52
有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);