0% found this document useful (0 votes)
15 views4 pages

CLC

Uploaded by

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

CLC

Uploaded by

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

clc

clear

% Prompt user for input values

disp('OFFSET SINGLE SLIDER CRANK MECHANISM');

disp(' ');

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

b = input('Enter length of connecting rod (b) : '); % Length of connecting rod link

c = input('Enter offset of slider (c) : '); % Offset of slider

if c > a+b

disp('This Offset Single Slider Crank Mechanism is not possible');

return;

end

theta2 = input('Enter crank angle theta2 (in degrees): '); % Crank angle in degrees

omega2 = input('Enter angular velocity of crank (omega2): '); % Angular velocity of crank

alpha2 = input('Enter angular acceleration of crank (alpha2): '); % Angular acceleration of crank

theta2_r = deg2rad(theta2);

theta3_r = 3.1416 + asin(-(a*sin(theta2_r) - c)/b);

theta3 = rad2deg(theta3_r);

fprintf('Angular Position of Connecting Rod from Slider Axis : %.2f degree\n', theta3);

d = a*cos(theta2_r) - b*cos(theta3_r);

fprintf('Linear Position of Slider from fixed point of crank : %.2f mm\n', d);

omega3 = (a*cos(theta2_r)/(b*cos(theta3_r)))*omega2;
fprintf('Angular Velocity of Connecting Rod : %.2f rad/s\n', omega3);

velslider = - a*omega2*sin(theta2_r) + b*omega3*sin(theta3_r) ;

fprintf('Linear Velocity of Slider : %.2f mm/s\n', velslider);

alpha3 = (a*(alpha2)*cos(theta2_r)-
a*((omega2)^2)*sin(theta2_r)+b*((omega3)^2)*sin(theta3_r))/b*cos(theta3_r);

fprintf('Angular Acceleration of Connecting Rod : %.4f (rad/s^2)\n', alpha3);

accslider = -a*(alpha2)*sin(theta2_r)-
a*((omega2)^2)*cos(theta2_r)+b*(alpha3)*sin(theta3_r)+b*((omega3)^2)*cos(theta3_r);

fprintf('Linear Acceleration of Slider : %.4f (mm/s^2) \n', accslider);

% Set up crank angle theta2 range (in degrees) for full rotation

theta2_range_deg = linspace(0, 360, 360); % 0 to 360 degrees in increments

% Initialize arrays to store results

theta3_array = zeros(size(theta2_range_deg));

velslider_array = zeros(size(theta2_range_deg));

accslider_array = zeros(size(theta2_range_deg));

% Loop over each crank angle theta2 to calculate parameters

for i = 1:length(theta2_range_deg)

% Convert theta2 to radians

theta2_r = deg2rad(theta2_range_deg(i));

theta3_r = 3.141592653589793 + asin(-(a*sin(theta2_r) - c)/b);

theta3 = rad2deg(theta3_r);
% Store connecting rod angle theta3

theta3_array(i) = theta3_r;

d = a*cos(theta2_r) - b*cos(theta3_r);

omega3 = (a*cos(theta2_r)/(b*cos(theta3_r)))*omega2;

velslider = - a*omega2*sin(theta2_r) + b*omega3*sin(theta3_r) ;

alpha3 = (a*(alpha2)*cos(theta2_r)-
a*((omega2)^2)*sin(theta2_r)+b*((omega3)^2)*sin(theta3_r))/(b*cos(theta3_r));

accslider = -a*(alpha2)*sin(theta2_r)-
a*((omega2)^2)*cos(theta2_r)+b*(alpha3)*sin(theta3_r)+b*((omega3)^2)*cos(theta3_r);

% Store linear velocity and acceleration of slider

velslider_array(i) = velslider;

accslider_array(i) = accslider;

end

% Plot Linear Velocity of Slider vs. Crank Angle

figure;

plot(theta2_range_deg, velslider_array, 'b-', 'LineWidth', 1.5);

xlabel('Crank Angle (degrees)');

ylabel('Linear Velocity of Slider (mm/s)');

title('Linear Velocity of Slider vs. Crank Angle');

grid on;
% Plot Linear Acceleration of Slider vs. Crank Angle

figure;

plot(theta2_range_deg, accslider_array, 'r-', 'LineWidth', 1.5);

xlabel('Crank Angle (degrees)');

ylabel('Linear Acceleration of Slider (mm/s^2)');

title('Linear Acceleration of Slider vs. Crank Angle');

grid on;

You might also like