“fourbarpos” Function Group 13
% This is a function that is used in the main code that plots the behavior of our fourbar mechanism.
function [theta_3, theta_4] = fourbarpos(l,theta_1,theta_2,delta)
% define bar lengths
a = l(2);
b = l(3);
c = l(4);
d = l(1);
% theta_1_r = deg2rad(theta_1);
% theta_2_r = deg2rad(theta_2);
% define K values
K1 = d/a;
K2 = d/c;
K3 = ((a^2)-(b^2)+(c^2)+(d^2))/(2*a*c);
% calculate A B C
A = cosd(theta_2) - K1 - (K2*cosd(theta_2)) + K3;
B = (-2)*sind(theta_2);
C = K1 - ((K2+1)*cosd(theta_2)) + K3;
% calculate theta_4
theta_4 = 2*atand((-B+(delta*sqrt((B^2)-(4*A*C))))/(2*A));
% calculate theta_3
theta_3 = asind(((c*sind(theta_4))-(a*sind(theta_2)))/b);
% display angle values
% fprintf("Angle 3 = %.3f\n", theta_3);
% fprintf("Angle 4 = %.3f\n", theta_4);
Welcome to the University Wiki Service! Please use your IID (yourEID@eid.utexas.edu) when prompted for your email address during login or click here to enter your EID. If you are experiencing any issues loading content on pages, please try these steps to clear your browser cache.