Fourbar Linkage Coupler Path

17 views (last 30 days)
Charitha Heshan
Charitha Heshan on 19 Sep 2018
Edited: John D'Errico on 19 Sep 2018
hey guys im writing to a code to demonstrate NON Grashof four bar triple rocker to plot the coupler curve of point P with respect to the global reference frame XY & the transmission angles vs input angles.Im not very good at matlab so if you could point out what i should understand that will be very helpful.
if true
%code
% // Note and symbols
% // R2 Input link // R1 ground link // R3 coupler link // R4 rocker
% // P coupler point // beta the coupler angle(Degrees)
% // RA,RB,RP,RPA position vector of the point A, B, P, point P refer to point A
% // input data for 4 bar linkage %
fprintf('\n');
L1 = input('input ground = ');
L2 = input('input link 2 = ');
L3 = input('input link 3 = ');
L4 = input('input link 4 = ');
fprintf('\n');
% // define point p position.
fprintf('\n');
PA = input('input link PA = ');
qpd = input('input point P (degree)= ');
fprintf('\n');
% // transfer 4 bar dimension
R1 = L1; R2 = L2; R3 = L3; R4 = L4; %qpd = 56.0;
beta=qpd
%cta = 14;
alpha = cta
q2=arccos(((a.^2+d.^2-b.^2-c.^2)/(2*a*d))- (b*c)/(a*d)))
%Define K
K1 = d/a
K4 = d/b
K5 = (c^2 - d^2 - a^2 - b^2) / (2*a*b)
%
D(q2) = cos(q2) - K1 + K4*cos(q2) + K5
E(q2) = -2*sin(q2)
F(q2) = K1 + (K4-1)*cos(q2) + K5
%
q31(q2) = 2*atand (( -E + sqrt(E^2 -4*D*F))/2*D)
q32(q2) = 2*atand (( -E - sqrt(E^2 -4*D*F))/2*D)
% // coupler position (P)
RA(q2) = a*(cos(q2) + j*sin(q2));
RPA(q2) = p*(cos(q3+beta) + j*sin(q3+beta));
RP = RA + RPA;
RPx(q2) = a*cos(q2)+p*cos(q3(q2)+beta); % position x of link P
RPy(q2) = a*sin(q2)+p*sin(q3(q2)+beta); % position y of link P
% Transform to the Global Frame
Xp(q2) = RPx(q2)*cos(alpha)-RPy(q2)*sin(alpha)
Yp(q2) = RPx(q2)*sin(alpha)+RPy(q2)*cos(alpha)
// plot path A, B and P
subplot(3,2,1);
plot(Ax,Ay, Bx,By, Px,Py) % path for A,B and P
title('linkage path motion')
legend('point A','point B','point P')
ylabel('y-axis')
xlabel('x-axis')
axis([xmin*1.5 xmax*1.5 ymin ymax])
daspect([1 1 1]) % fix plot ratio 1:1
set(legend,'color','none');
grid on
end
If you need the relevant problem statement please let me know.
  2 Comments
Alessandro Mingarelli
Alessandro Mingarelli on 14 Apr 2021
Perché non può? Ha chiesto solo se fosse giusto e qualche consiglio per migliorare il codice...

Sign in to comment.

Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!