Use MATLAB to calculate the positions of B and C of the slid
Use MATLAB to calculate the positions of B and C of the slider-crank shown below for theta values from 0 to pi in pi/8 increments. Length AB=2.5 inches, length BC=7.0 inches.
Once the plot has been made, use the “axis image” command to make the axes have the same scale, and to be bound tightly to the image dimensions.
Now let the crank AB have a constant angular velocity ?=1.5 rad/s. Calculate the x and y components of the velocity vector for points B and C. Use the “quiver” function to plot the velocity vectors on top of the mechanism. Make a second, separate plot that shows the velocity components and total velocity magnitude of points B and C as a function of theta.
Solution
Matlab Code
theta = 0:pi/8:pi;
xb = 2.5*cos(theta);
yb = 2.5*sin(theta);
theta3 = asin(2.5*sin(theta)/7);
xc = xb + 7*cos(theta3);
figure(1)
plot(xb,yb,\'-o\',xc,0,\'-*\')
vbx = -2.5 * 1.5 * sin(theta);
vby = 2.5 * 1.5 * cos(theta);
vbtotal = sqrt(vbx.^2 + vby.^2);
vcy = 0;
figure(2)
plot(theta,vbx,\'-d\',theta,vby,\'-o\',theta,vbtotal,\'-*\')
