What am I doing wrong on this problem?

Question:
For the walking beam mechanism in the figure below, calculate and plot the x and y components of the position of the coupler point P for one complete revolution of the crank O2A. Hint: Calculate them first with respect to the ground link O204 and then transform them into the global XY coordinate system (i.e., horizontal and vertical in the figure). Scale the figure for any additional information needed.
%%Walking Beam Problem
clear all; close all; clc;
%%Variables
a=1;
b=2.06;
c=2.33;
d=2.22;
p=3.06;
gamma=31*pi/180;
theta2= zeros (360,1)
%%Main Program
for i=1:361;
theta2(i)=(i-1)*(pi/180);
r=d-a*cos(theta2(i));
s=a*sin(theta2(i));
f2=r^2+s^2;
delta=acos((b^2+c^2-f2)/(2*b*c));
g=b-c*cos(delta);
h=c*sin(delta);
theta3(i)=atan2(h*r-g*s,g*r+h*s);
xp(i)=a*cos(theta2(i)+p*cos(theta3(i)+gamma));
yp(i)=a*sin(theta2(i)+p*sin(theta3(i)+gamma));
end
plot(xp,yp,'color','r')
grid on
title ('title')
xlabel('title')
ylabel('title')

4 Comments

no figure was included
Image Analyst
Image Analyst on 18 Sep 2015
Edited: Image Analyst on 18 Sep 2015
The PNG image you attached just shows gibberish. Try it and see. And why do you think something is wrong? What indicates that to you?
Lately, my browser has tried to render most images as if they were text, including this one. If I download the image and use a viewer then it shows up fine.
The path that the graph follows doesn't make sense when compared to the mechanism I am trying to calculate the positions of. For the most part, I just copied the code from a problem we did in class hoping it would work. I really have no understanding of Matlab.

Sign in to comment.

Answers (0)

Categories

Find more on Mathematics in Help Center and File Exchange

Asked:

on 17 Sep 2015

Edited:

on 20 Sep 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!