Four Bars Mechanism: i cannot understand why CP modifies his length.

1 次查看(过去 30 天)
clear all;
clc;
AB=1;
CD=1;
BP=AB;
CP=AB; %[m]
xD=2*AB
yD=0;
incr=1
for phi=0:1/30:2*pi
xA=0;
yA=0;
rA=[xA,yA,0];
xB=AB*cos(phi);
yB=AB*sin(phi);
rB=[xB,yB,0];
rD=[xD,yD,0];
yP=0;
yPb=yP;
yPc=yP;
yD=0;
xC=2-CD*cos(pi/2-phi);
yC=CD*sin(pi/2-phi);
rD=[xD,yD,0];
rC=[xC,yC,0];
syms xPsol xPcsol
solP=solve((xPsol-xB)^2+(yB-yP)^2==BP^2);
solPc=solve((xPcsol-xC)^2+(yC-yP)^2==CP^2);
xP1=eval(solP(1));
xP2=eval(solP(2));
yP1=eval(solP(1));
yP2=eval(solP(2));
xP3=eval(solPc(1));
xP4=eval(solPc(2));
yP3=eval(solPc(1));
yP4=eval(solPc(2));
if xP1>xB
xP=xP1;
else
xP=xP2;
end
if xP3<xC
xPc=xP3;
else
xPc=xP4;
end
rP=[xP,yP,0];
rP=[xPc,yPc,0];
plot([xA,xB],[yA,yB],'k-',[xB,xP],[yB,yP],'b-',[xD,xC],[yD,yC],[xC,xP],[yC,yP],'g-')
text(xA,yA,'A');
text(xB,yB,'B');
text(xP,yP,'P');
text(xC,yC,'C');
text(xD,yD,'D');
grid
axis([-2 4 -2 2])
manovellismoroberts(:,incr)=getframe;
incr=incr+1;
end
hold on
movie(manovellismoroberts,3,200)
vidobj=VideoWriter('manovellismoroberts.avi')
open(vidobj)
writeVideo(vidobj,manovellismoroberts)
close(vidobj)

回答(1 个)

Pratyush
Pratyush 2023-7-27
I understand that you want to know the reason behind why does CP keep changing its length.The length of CP is initially set to AB at the beginning of the code: CP=AB; %[m]. However, as the loop iterates through different values of phi, the length of CP is modified using the following line of code:
xC=2-CD*cos(pi/2-phi);
yC=CD*sin(pi/2-phi);
Here, the x and y coordinates of point C are calculated based on the value of phi and the length of CD. Since phi changes in each iteration, the position of point C changes accordingly, which in turn affects the length of CP. Therefore, CP appears to change its length because it is being dynamically updated based on the value of phi during each iteration of the loop.
  1 个评论
Joe Propp
Joe Propp 2023-7-27
I think the problem lies in the mechanism, point P has a sinusoidal speed. I can't find a way to make these 4 rods move. would you have an idea?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Fluid Dynamics 的更多信息

产品


版本

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by