Question
animate on matlab
has to be a simple 4 bar mechanism
Lab Sessioh 2 Animate the 4-bar Mo tion e ena.8 mat lab Crant rock er Doubit Cronk Doo ble rocker
1 0
Add a comment Improve this question Transcribed image text
Answer #1

Double Crank: C+D A+B, D is B the shortest Link C A Double Rocker: A+B>C+D, B is the D shortest link Crank Rocker: C+D A B, A

For Crank rocker

Take : A = 1 , B = 2, C = 3,D= 4

For Double Crank

Take : A = 3 , B = 3, C = 5,D= 2

For Double Rocker

Take : A = 6 , B = 3, C = 4,D= 4

We can run the following matlab code 3 times for 3 cases with various lengths.

Matlab Code:

clc; clear;
% Parameters
A = 1; B = 2; C = 3; D = 4;

t = 0:0.05:10;

ang_speed = 2;
theta = ang_speed*t;

P1 = [0;0];
P4 = D*[1;0];

P2 = A*[cos(theta); sin(theta)];
E = sqrt(A^2 + D^2 - 2*A*D*cos(theta));
alfa = asin(A*sin(theta)./E);
beta = acos((E.^2 + C^2 - B^2)./(2*E*C));
P3 = [D - C*cos(alfa+beta); C*sin(alfa+beta)];

P3_x = P3(1,:);
P3_y = P3(2,:);

P3_vx = diff(P3_x)./diff(t);
P3_vy = diff(P3_y)./diff(t);

P3_v = sqrt(P3_vx.^2 + P3_vy.^2);

for i=1:length(t)

ani = subplot(2,1,1);
P1_circle = viscircles(P1',0.05);
P2_circle = viscircles(P2(:,i)',0.05);
P3_circle = viscircles(P3(:,i)',0.05);
P4_circle = viscircles(P4',0.05);

A_bar = line([P1(1) P2(1,i)],[P1(2) P2(2,i)]);
B_bar = line([P2(1,i) P3(1,i)],[P2(2,i) P3(2,i)]);
C_bar = line([P3(1,i) P4(1)],[P3(2,i) P4(2)]);

axis(ani,'equal');
set(gca,'XLim',[-5 8],'YLim',[-2 7]);

str1 = 'P3';
str2 = ['Time elapsed: ' num2str(t(i)) ' s'];
P3_text = text(P3(1,i),P3(2,i)+0.4,str1);
Time = text(-2,6,str2);
pause(0.005);
if i<length(t)
delete(P1_circle);
delete(P2_circle);
delete(P3_circle);
delete(P4_circle);
delete(A_bar);
delete(B_bar);
delete(C_bar);
delete(P3_text);
delete(Time);
vel = subplot(2,1,2);
plot(vel,t(1:i),P3_v(1:i));
set(vel,'XLim',[0 10],'YLim',[0 10]);
xlabel(vel, 'Time (s)');
ylabel(vel, 'Amplitude (m/s');
title(vel,'Speed of P3');
grid on;
end

end

Time elapsed: 10s 6 4 P3 2 0 2 -5 5 0 Speed of P3 5 C 10 9 8 7 6 5 3 4 2 1 0 Time (s) LO st LC 10 Amplitude (m/s

Add a comment
Know the answer?
Add Answer to:
animate on matlab has to be a simple 4 bar mechanism Lab Sessioh 2 Animate the 4-bar Mo tion e ena.8 mat lab Crant r...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT