0% found this document useful (0 votes)
13 views3 pages

MATLAB Code

Uploaded by

.mhtyy
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)
13 views3 pages

MATLAB Code

Uploaded by

.mhtyy
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/ 3

MATLAB Code

% Jansen Mechanism Analysis

% Parameters (lengths in mm, angle in degrees)

L1 = 100;

L2 = 31;

L3 = 185;

L4 = 157;

L5 = 129;

L6 = 83;

L7 = 100;

L8 = 101;

L9 = 94;

L10 = 94;

L11 = 117;

L12 = 168;

theta1_initial = 16.1; % degrees

omega2 = 6.283; % rad/s

% Time settings

t = linspace(0, 1, 100); % time vector for one full cycle

theta2 = omega2 * t; % crank angle as a function of time

% Initialize position arrays

X_tip = zeros(size(t));

Y_tip = zeros(size(t));

% Position Analysis

for i = 1:length(t)

% Position equations (example)

theta1 = deg2rad(theta1_initial); % converting to radians

% Example for calculating tip position (this needs to be adjusted for Jansen's mechanism)

% Assumes tip coordinates depend on L1 and L2; actual Jansen mechanism equations are more complex.

X_tip(i) = L1 * cos(theta1) + L2 * cos(theta2(i));


Y_tip(i) = L1 * sin(theta1) + L2 * sin(theta2(i));

end

% Velocity Analysis

VX_tip = gradient(X_tip, t);

VY_tip = gradient(Y_tip, t);

% Acceleration Analysis

AX_tip = gradient(VX_tip, t);

AY_tip = gradient(VY_tip, t);

% Plotting Results

figure;

subplot(3,1,1);

plot(X_tip, Y_tip);

title('Position of Tip');

xlabel('X (mm)');

ylabel('Y (mm)');

grid on;

subplot(3,1,2);

plot(t, VX_tip, 'r', t, VY_tip, 'b');

title('Velocity of Tip');

xlabel('Time (s)');

ylabel('Velocity (mm/s)');

legend('VX', 'VY');

grid on;

subplot(3,1,3);

plot(t, AX_tip, 'r', t, AY_tip, 'b');

title('Acceleration of Tip');

xlabel('Time (s)');

ylabel('Acceleration (mm/s^2)');

legend('AX', 'AY');

grid on;

You might also like