A = 1;
B = 2*LENGTH_AB*sin(ANGLE_ALPHA);
C = (((LENGTH_AB)^2 + 2*LENGTH_CD*LENGTH_AB*cos(ANGLE_ALPHA) + LENGTH_CD^2 - LENGTH_BC^2));
LENGTH_DA = (B + sqrt(B^2 - 4*C))/2;
B = 2*LENGTH_AB*sin(ANGLE_ALPHA);
C = (((LENGTH_AB)^2 + 2*LENGTH_CD*LENGTH_AB*cos(ANGLE_ALPHA) + LENGTH_CD^2 - LENGTH_BC^2));
LENGTH_DA = (B + sqrt(B^2 - 4*C))/2;
A small part of the MatLab code I wrote while trying to implement a slider crank mechanism. This one was kinda tricky as the problem presented was somewhat restrictive.
The cylinder was oscillating on a translational path along the x axis above the crank. I only was given the angle at the crank source, its angular velocity, the magnitude of the arms and potential offset of the cylinder. After much digging, I decided to try this method as it allowed me write all distances in vector form. This way, I will be able to determine the maximum angle the crank end can go as it is somewhat dependent on the magnitude of the arms. I plan to add more features to this system later.
NOTE: The code chunk above is only for the positive roots. Negative roots was not needed for this problem. Might be once I start to expand the capabilities of this program.
No comments:
Post a Comment