syms l1 l2 theta1 theta2 w1 w2 vc alpha2 ac
f=[l2*sin(theta2) 1;-l2*cos(theta2) 0]*[alpha2;ac]+[w2*l2*cos(theta2) 0;w2*l2*sin(theta2) 0]*[w2;vc]-w1*[-w1*l1*cos(theta1);-w1*l1*sin(theta1)];
%把方程移项写成f(x,y)=0的形式,把等号左边的内容输进来
Answer=solve(f,'alpha2','ac');
alpha2=Answer.alpha2
ac=Answer.ac
%最后得到符号表达式
--------------------------------------------
alpha2 =
(l1*sin(theta1)*w1^2 + l2*sin(theta2)*w2^2)/(l2*cos(theta2))
ac =
-(l1*cos(theta1)*w1^2*cos(theta2) + l1*sin(theta1)*w1^2*sin(theta2) + l2*w2^2*cos(theta2)^2 + l2*w2^2*sin(theta2)^2)/cos(theta2)
----------------------------------------------------
如果想看得清楚些,可以用pretty(alpha2),pretty(ac)将答案显示成类似手写的样子。。。不太会表达~~~