0% found this document useful (0 votes)
43 views2 pages

KDM Matlab Assignment

Uploaded by

mayankmaroliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views2 pages

KDM Matlab Assignment

Uploaded by

mayankmaroliya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

clc;clear;close all;

%a = input ('Enter crank length : ');


%b = input ('Enter coupler length : ');
%c = input ('Enter follower length : ');
%d = input ('Enter fixed length : ');

a=20;
b=40;
c=45;
d=50;

k1 = d/a;
k2 = d/c;
k3 = (a^2-b^2+c^2+d^2)/(2*a*c);
k4 = d/b;
k5 = (c^2-d^2-a^2-b^2)/(2*a*b);

th3_o = zeros(13,1);
th3_c = zeros(13,1);
th4_o = zeros(13,1);
th4_c = zeros(13,1);
tr_o = zeros(13,1);
tr_c = zeros(13,1);
th2 = 0;

for i=1:13

%calculating follower angle (th4)


A = cosd(th2)-k1-(k2*cosd(th2))+k3;
B = -2*sind(th2);
C = k1-(k2+1)*(cosd(th2))+k3;
th4_o(i,1)=2*atand((-B - sqrt(B^2-(4*A*C)))/(2*A));
th4_c(i,1)=2*atand((-B + sqrt(B^2-(4*A*C)))/(2*A)) + 360;

%calculating coupler angle (th3)


D = cosd(th2)-k1+(k4*cosd(th2))+k5;
E = -2*sind(th2);
F = k1 + (k4-1)*cosd(th2) + k5;
th3_o(i,1)=2*atand((-E - sqrt(E^2-(4*D*F)))/(2*D));
th3_c(i,1)=2*atand((-E + sqrt(E^2-(4*D*F)))/(2*D)) + 360;

%calculating Transmission angle (tr)


tr_o(i,1) = acosd((b^2+c^2-a^2-d^2)/(2*b*c))+((a*d*cosd(th2)/(b*c)));
tr_c(i,1) = acosd((b^2+c^2-a^2-d^2)/(2*b*c))-((a*d*cosd(th2)/(b*c)));
%tr_c(i,1) = acosd((c^2+b^2-d^2-a^2)/(2*b*c))-((d*a/b*c)*cosd(th2));

th2=th2+30;
end
disp('Follower Angle');
disp([th4_o,th4_c]);
disp('Coupler Angle');
disp([th3_o,th3_c]);
disp('Transmission Angle');
%disp(tr_o);
disp([tr_o,tr_c]);

..................................................................................

clc;clear;close all;
a = input ('Enter crank length : ');
b = input ('Enter coupler length : ');
c = input ('Enter slider length : ');
th2 = input ('Enter Input angle : ');

th4 = 90;

%calculating coupler angle (th3)


th3 = asind((c-(a*sind(th2)))/b);
th3 = 360-th3;
%calculating the length of slider (d)
d = (a*cosd(th2)) + (b*cosd(th3));

disp('Coupler angle : ');


disp(th3);
disp('Length of slider : ');
disp(d);

You might also like