平面四连杆运动方程分析with matlab
以下是平面四连杆的运动学分析:
%%***************planner four links system**********%%
function fourlinks
clc;
clear all;
%%
%输入结构参数
global l1 l2 l3 l4 theta2
l1=0.4;l2=0.2;l3=0.4;l4=0.5;
w2=50;
pi=3.1415926;
x0=[0.79 4.9];
n=500;
%%
for i=1:n
theta2=pi/2+(i-1)*0.02;
x=fsolve(@f3_4,x0,optimset('fsolve'));
z34(i,:)=x; %角位移存储矩阵
%%
%**********位置分析**************
x0=x;
z2(i)=theta2; %曲柄角度存储矩阵
%%
%%**************速度分析*********
c=l2*w2/(l3*l4*sin(x(2)-x(1)));
w34(i,1)=c*l4*sin(theta2-x(2));
w34(i,2)=c*l3*sin(-theta2+x(1));
%%
%*************加速度分析*********
c1=l4*w34(i,2)^2*cos(x(2))+l2*w2^2*cos(theta2)...
+l3*w34(i,1)^2*cos(x(1));
c2=l4*w34(i,2)^2*sin(x(2))+l2*w2^2*sin(theta2)...
+l3*w34(i,1)^2*sin(x(1));
c3=l3*l4*sin(x(2)-x(1));
a34(i,1)=l4*(c1*cos(x(2))+c2*sin(x(2)))/c3;
a34(i,2)=-l3*(c1*cos(x(1))+c2*sin(x(1)))/c3;
%%
end
%%
figure(1);
plot(z2,z34)
grid on;
legend('theta_3','theta_4');
xlabel('theta2','color','r','fontsize',8);
ylabel('theta3 theta4','color','y','fontsize',8);
figure(2)
plot(z2,w34)
grid on
legend('w_3','w_4');
xlabel('theta_2','color','b','fontsize',12,'linewidth',5);
ylabel('w_3_4','color','b','fontsize',12,'linewidth',7);
figure(3)
plot(z2,a34)
grid on
legend('a_3','a_4');
xlabel('theta_2','color','b','fontsize',12,'linewidth',5);
ylabel('a_3_4','color','b','fontsize',12,'linewidth',7);
end
%%
function y=f3_4(x)
clc;
global theta2
l1=0.4;
l2=0.2;
l3=0.4;
l4=0.5;
y(1)=l3*cos(x(1))+l4*cos(x(2))-l1+l2*cos(theta2);
y(2)=l3*sin(x(1))+l4*sin(x(2))+l2*sin(theta2);
end
运行结果: