mae412 machines & mechanisms ii final project report€¦ · mae412 machines & mechanisms...
TRANSCRIPT
MAE412 MACHINES & MECHANISMS II FINAL PROJECT REPORT
GROUP D: Edward Hurley Timothy Howe Eric Herman Paul Harris
James Golimowski Eric Goldeier David Glatt
Harold Gerber
2002.12.13 Dr. Krovi
INTRODUCTION
Our team was assigned the task of developing catapult system that would be used
to throw a squash ball the furthest distance possible. Our team’s resolve was to
collaborate together in order to create a catapult system that would accomplish the
aforementioned task, while following the imposed cons traints.
Project Constraints:
1. The mechanism must use at least a 4-bar (5-bar, or 6-bar) mechanism in order to
accomplish the task.
2. Each team can only use one “standard motor” (that will be specified below) for
powering the system.
3. The entire mechanism must be made of wood.
4. The entire mechanism must never leave an operating window of 2’ x 2’ and the
operating window must include the entire base plate within the window.
5. The mechanism should be mounted on a base plate such that it can be quickly
clamped onto a table (using 2 C clamps) as shown in the figure.
6. No part of the mechanism should cross the start plane from where the judges will
measure the distance traveled by the squash ball.
7. Each team is limited (thus far) to the following materials in addition to wood as
mentioned in constraint No. 3.: Gears, screws, bearings, eye-hooks, springs,
pulleys, washers, and string.
8. Energy storage of any type, prior to motor startup, is prohibited.
9. Each team will have a thirty-second (30sec) motor run time limit.
Our team found it challenging, at times, to incorporate many of the ideas that we had
compiled due to the constraints required for the project. Some our original ideas required
expensive parts, or materials that were not allowed for the competition. This is one of the
main reasons that we selected a slider crank design. We felt that this design would be:
(1) Practical – In the sense that it would be relatively easy to create, (2) Functional – In
that it had great potential to actually work. In addition, the slider crank design would also
allow us to work within the boundaries of the project scope due to its relatively simple
component makeup – such as the slider, basic links and joints, which are very easy to
manipulate. This proved to be the case during the actual building of the catapult. We
had some problems assembling the actual unit, but properly meeting the design
constraints was not as frustrating, as we originally predicted.
IDEA GENERATION
To produce the best design of a four bar throwing mechanism our team first went
through a couple of brainstorming sessions. This was mainly comprised of divergent idea
generation techniques. Several solutions to the stated problem were generated, and those,
which were ideal and capable of being produced as a final product, were considered.
Since all ideas provided by team members were considered; it provided the team with
large amount of ideas to help solve the problem. The ideas that violated any of the
constraints provided in the project statement were then eliminated.
The initial design concept of our team was to incorporate a type of explosion to
cause the ball to be thrown with great force. The constraints stated that no stored energy
was to be used, only energy that could be produced in the 30 second setup period. This
eliminated any type of pressure or combustion devices. The next idea was to use some
type of pneumatic device to build pressure that could be used to throw the ball. A five
bar mechanism, which would pump air into a cylinder, similar to the oil well pumps
found in Texas, was considered. Also, a five bar mechanism, similar to the piston-crank
assembly found in an engine of a car, was also considered. This too would pump high-
pressure air into a cylinder. The constraints also stated that the device created must be
comprised of wood and some metals; used for gears or pins. Therefore, any type of
pressurized or pneumatic device could not be used because of the inability to seal a wood
pressure vessel.
FIGURE 1:
OIL WELL PUMP PISTON-CRANK ASSEMBLY
The second phase of our idea generation was a bit more convergent, in that the
ideas that were produced were similar but was focused on a spring based design. It was
decided that a four bar would compress a spring that would then be triggered and the
stored energy in the spring would launch the ball. The first idea generated with these
constraints was a four bar double crank mechanism that would “reel” in a strand of twine
attached to the end of the spring. This in turn would compress the spring, and create
enough energy stored in the spring to launch the projectile. The trigger mechanism
seemed to be the hardest part of this solution to design. Also, the ball was to be placed
inside a tube that would be greased so that the spring and ball could pass through swiftly
and without any resistance. Next anothe r formation of the four bar mechanism was
considered. This formation was the slider crank. A combination of the tube and spring
were combined with a slider crank four-bar mechanism so that the trigger problem could
be solved. A razor to trigger the spring that would then launch the projectile would cut
twine. The slider crank four-bar was to provide us with higher potential energy because
of the way the four bars compressed the spring.
CANON PAINT BALL GUN
The ideas that were produced over the entire process of brainstorming the
problem were combined to form a final solution that would launch the projectile. The
launch angle was decided to be 45 degrees, which would provide the longest distance for
when the projectile would be launched. It was agreed to pursue the design with a slider
crank four-bar which the motor powered. This would compress a spring that in turn
when triggered would launch a swash ball.
DESCRIPTION OF THE MECHANISM The catapult uses a four-bar slider-crank to store energy in spring, and as the four-
bar completes its cycle, it triggers a release mechanism that launches the spring. As seen
in FIGURE 2, the motor will wind up a string connected to the four-bar’s crank. The
crank then pushes the coupler and the follower (slider) link. The slider- link in turn tugs
on the string, which elongates the spring, inside the metal tube. Once the crank link is
almost parallel with the coupler link, the attached razor on the crank will cut the string
deforming the spring. The spring will snap back into its preset position, launching the
ball. FIGURE 3 offers a couple other views of the mechanism.
FIGURE 2: Final Design of our Slider Crank 4-Bar Mechanism
This top string connects the coupler link to the motor, and the bottom string connects the slider to the spring.
This is where the spring is put in tension and finally released to shoot our projectile.
The 22- inch coupler link and the 9-inch follower link
Our twin ramps angled at 45 degrees to maximize our trajectory.
The slider that pulls the string
FIGURE3:
DYNAMIC DESIGNER PROTOTYPE A Dynamic Designer prototype of the mechanism was created. The position,
velocity, acceleration and force profiles of critical points/links are plotted in FIGURE 4.
These were used to determine the dimensions of the mechanism while satisfying some of
the constraints.
FIGURE 4:
(A) Spring Acceleration
(B) Spring Displacement
0.00 0.04 0.09 0.13 0.18 0.22Time (sec)
1 71661143322214983286643358304429964
Tran
s A
ccel
- M
ag (m
m/s
ec**
2)
0.00 0.04 0.09 0.13 0.18 0.22Time (sec)
116
134
152
171
189
207
226
Tran
s D
isp
- M
ag (
mm
)
(C) Spring Velocity
(D) Spring Force
FIGURE 5 shows a sample still image of the prototype. The other associated files
are on the media accompanying this report.
0.00 0.04 0.09 0.13 0.18 0.22Time (sec)
0
477 954
14321909
23862863
Tran
s V
eloc
- M
ag (
mm
/sec
)
0.00 0.20 0.40 0.60 0.80 1.00Time (sec)
0
76
153
229
305
382
458
For
ce -
Mag
(ne
wto
n)
FIGURE 5:
SIMULATION BASED DESIGN The design and dimensions of the mechanism were balanced between our
constraints and our optimization techniques. The constraints were that the mechanism
must fit in a 2-foot by 2-foot box and must be easy to manufacture. We also designed an
actual 4-bar mechanism so that the dimensions could be varied for optimization. This in
conjunction with synthesis calculations performed in MATLAB allowed us to determine
a range of values for our dimensions that predicted a long trajectory.
The coupler and follower links are 22 and 9 inches, respectively. The follower
link is connected to the coupler link 10 inches from the base. There are also two ramps,
one for the slider to offset and one for the launch of the ball.
The dimensions of the coupler link were chosen for several reasons. The length
chosen maximized our motor efficiency as the motor pulled the link via a string
connection to its final position. This operation took just under 30 seconds, which was the
maximum time we were allocated, thus offsetting the link by the optimal distance. We
agreed on a time a little less than 30 seconds to allow for some error when the motor
begins to wear down. The dimensions of this link are also critical for the release
mechanism. The string that extends our spring runs through a slot in the coupler arm and
connects to the slider. This string extends up through the coupler as the link is offset until
it reaches its final position. Then the string comes in contact with a razor that snaps the
string and releases our spring, and finally our projectile. The position of the string inside
the coupler link is critical otherwise our device will launch the ball before the mechanism
is at the final position.
The follower link length was determined based on the coupler link length and
three attributes. First, the link’s initial position must rest on the bottom of the ramp to
provide enough room for the slider to offset. Second, its final position must rest close to
the top of the ramp so the slider extends the spring to the maximum. Finally, the angles of
the ramps are 45 degrees that we found is the optimum angle for the furthest trajectory.
ANALYSIS OF SLIDER CRANK
Position Analysis: Method 3 Loop Closure: R1cos?1 + R4cos?4 = R2cos?2 + R3cos?3
R1sin?1 + R4sin?4 = R2sin?2 + R3sin?3
Square both sides, add the two equations together, and then use sin2+cos2 =1 substitution: R1
2 = R32 + R2
2 + R42 +2 R3 R4 (cos?3 cos?4 + sin?3 sin?4) - 2 R3 R2(cos?3 cos?2 +
Sin?3 sin?2) - 2 R2 R4(cos?2 cos?4 + sin?2 sin?4) Define new Variables P, Q, and R: P= 1
Q= 2*(R4 cos?4 - 2 R2 cos?2 )*cos ?1 + 2*(R4 sin?4 - R2 sin?2)*sin ?1 R= (R4 cos?4 - 2 R2 cos?2 ) 2 + (R4 sin?4 - R2 sin?2) 2 -R3
2 These Variables are the coefficients for R1: Next we use the polynomial equation to solve for R1 : R1 = -Q + or – sqrt(Q2- R2 + P2) 2P R1 = 8.767 inches Since we know R1 now we can solve for ?3: So we can now plug into the original equations and find the angle: ?3 = -24.4226 or 335.5774 Position Analysis:
Here we take your results from the first analysis and use the found R1 to solve for R3 as a check. Method 2: Triangle Law R2i= R2cos?2 R1i =R1cos?1 R7i = R2 i -R1 i R4i =R4cos?4 R2j= R2sin?2 R1j =R1sin?1 R7j = R2j - R1j R4j =R4sin?4
Solve for R7 : R7 = sqrt(R7 i2 + R7j2) ?7 = tan-1(R7j /R7 i) ?7 =
R3i = (R4i - R7 i) R3j = (R4j – R7j) Solve for R3:
R3 = sqrt(R3 i2 + R3j2) R3 = 8 inches Velocity Analysis: Method 2: Loop Closure
A=
− 3cos*3__1sin
3sin*3__1cosθθ
θθr
r
B=
−2cos*2*2
2sin*2*2θ
θwr
wr
C= A –1 * B R1= 0.2586 rad/sec w3=0.0201 rad/sec Velocity Analysis Method 3: Intersecting Circles: I12= (0 , 0)
I23= (r2cos ?2 , r 2sin ?2) I34= (r2cos ?2 + r3cos ?3 , r 2sin ?2 + r3sin ?3 ) Find the slopes of the intersecting lines: m1= (r2sin ?2 / r2cos ?2) m2= tan ?4 x=(r2sin ?2 + r3sin ?3 – m2) / (m1-m2) y = (x*m1) I13= (x , y ) I13= (-0.0000 -1.2398)
w3 = 2)^2cos2(2)^2sin2(
2)^2cos2(2)^2sin2(*2
θθ
θθ
rxry
rrw
−+−
+
R 1= 2)^3sin32sin2(2)^3cos32cos2(*3 θθθθ rryrrxw −−+−− Acceleration Analysis:
A=
−−
3cos3__3sin3__
1sin1cos
θθ
θθ
rr
B=
−−−−−−
2cos*2*2)3sin*2)^3(*3()2sin*2)^2(*2(2sin*2*2)3cos*2)^3(*3()2cos*2)^2(*2(
θαθθθαθθ
rwrwrrwrwr
C=A–1 * B R1 double dot = 2.1450e+003 rad/sec^2 a3 = -166.5790 rad/sec^2 Force Analysis: Free Body Diagrams: Analysis of Each Link of the Slider Crank: Link 2: F12x + F32x = m2?g2
F12y + F32y = m2? g2
F12xa2sin ?2 - F12ya2cos ?2 - F32xb2sin ?2 + F32yb2cos ?2 = I2O2 Link 3: F43x - F32x = m3?g3
F43y - F32y = m3? g3 -F32xa3sin ?3 + F32ya3cos ?3 – F43xb3sin ?3 + F43yb3cos ?3 = I3O3
Link 4: F41x - F43x + Fsx = m4?g4
-F41y – F43y Fsy = m4? g4 -F43xa4sin ?4 + F43ya4cos ?4 – F41xb4sin ?4 + F41yb4cos ?4 RpxFsy - RpyFsx = I4O4
A= 1 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 -R12y R12x -R32y R32x 0 0 0 1 0 0 -1 0 1 0 0 0 0 0 0 -1 0 1 0 0 0 0 R32y -R23x -R43y R43x 0 0 0 0 0 0 -1 0 µ 0 0 0 0 0 0 -1 1 0 B= m2?g2 X= F12x
m2? g2 F12y I2O2 F32x m3?g3 F32y
m3? g3 F43x
I3O3 F43y
m4?g4 - Fsx F14y
I4O4 t
x= A –1* B A = 1.0000 0 -1.0000 0 0 0 0 0 0 1.0000 0 -1.0000 0 0 0 0 6.0000 -0.0000 6.0000 -0.0000 0 0 0 -1.0000 0 0 1.0000 0 -1.0000 0 0 0
0 0 0 1.0000 0 -1.0000 0 0 0 0 -2.0673 -4.5526 -2.4808 -5.4631 0 0 0 0 0 0 1.0000 0 0.5253 0 0 0 0 0 1.0000 0 0.8509 0 B=[
-414 ;9.9973 ;.25392 ;-1172.4 ;768.3635 ;-1388.10 ;1517.0835 ; -1503.164] x= 0.4804 -0.2092 0.5218 -0.2102 0.6390 -0.2870 -0.9276 5.0130 Torque required to run the catapult is 6.0130 lb- inch = 80.208 ounce- inch
Since the motor only puts out 75 ounce- inches we are going to have to use more voltage
and try to achieve more torque to power the catapult. Through testing we have found that
by adding an extra battery we can achieve enough motor power to run the catapult, but
the plastic gears are stripping under the strain.
The MATLAB code files are included on the media accompanying this report,
and also in APPENDIX A. FIGURE 6 contains the free body diagrams of each link and
the set-up of the necessary equations that are needed to find the bearing forces at each pin
joint.
FIGURE 6:
PHYSICAL CONSTRUCTION
There were several special features that we included in the design in coming up
with the final physical prototype:
1.) The release mechanism. We found that the simplest way to release the ball
and spring would be to have the string pulling the spring come loose or snap.
It became clear, that we would have to use the latter option. We fixed a blade
atop the crank link, and when it comes into the fully extended position, the
configuration with the most potential energy, it clips the string and releases
the ball.
2.) At first the string to be cut was guided around the crank and coupler link
through a set of eyelets. We realized that the movement through the eyelets
added an unnecessary amount of friction to the device. The solution was to
cut slots through the two links for the string to pass through.
3.) In getting the maximum amount of potential energy stored during our device’s
runtime, we needed the maximum amount of space for our spring, and
therefore our four-bar, to move through. One special feature we decided on
was to angle our baseboard at 45 degrees, to take advantage of the diagonal
distance (2.83 feet) of the 2-foot-by-2-foot board, rather than just use a 2-foot
depth.
4.) Greasing the spring and shaft assembly was another special feature of the
prototype, it minimized friction in one of its most highly concentrated areas.
5.) The most interesting and unique feature of the final prototype was the slider
crank, which was made from a keyboard desk shelf. The slider-crank, at the
time of construction, seemed to be an advantage over a regular crank and
follower four-bar, as lateral stresses on the follower were almost limited by
abstracting the third and fourth link into a slider.
DISCUSSION OF THE PERFORMANCE OF THE MECHANISM
Our team was pleased with the functionality of our catapult system, but unable to
fine-tune it to throw at distances equivalent to some of the other groups. The design
worked well, and met the criteria set forth in the original project scope. The original
project scope required a projectile to be thrown by a four-to-six bar system, although this
constraint was later revised to allow the four-to-six bar system to be incorporated into the
design without requiring the four-to-six bar to actually launch the projectile. For
instance, a four-bar could be used to power a one-bar launch, or a three-bar mechanism
could be attached to a primarily one-bar system in order to meet the link requirements.
This revision made the design project far less challenging than the original design
criteria. Therefore, based upon the greater degree of difficulty involved in the initial
design scope, which our team followed, we were pleased with our results in comparison
to the rest of the class.
In retrospect, it is evident that we could have improved our design if given the
opportunity. Even though we did optimize the dimensions of the four bar design, there
were still some changes that we could have made to the other system components. As
mentioned previously, some of our ideas were hindered by building and material
limitations. There are two main items that we would change if given the chance. The
first being the launch cylinder used to propel the squash ball. The cylinder was used to
project the ball by impact, whereas a better approach would be to use a larger cylinder
that would accelerate the ball with the spring. The momentum gained by the projectile
would surely improve our distance. Secondly, we would change the orientation of the
slider so that it would be inline with the cylinder. Following this approach would
eliminate most, if not all of the friction that was created from the eyehook component of
the design.
APPENDIX A: MATLAB ANALYSIS
%Acceleration analysis% r1=input ('Enter length of ground link'); r2=input ('Enter length of input length'); r3=input ('Enter length of coupler link'); r4=input ('Enter length of slider offset'); O1=input ('Enter O1 angle'); O2=input ('Enter O2 angle'); O3=input ('Enter O3 angle'); O4=input ('Enter O4 angle'); w2=input ('Enter w2'); w3=input ('Enter w3'); r1dot=input ('Enter r1dot'); O1=O1*pi/180; O2=O2*pi/180; O3=O3*pi/180; O4=O4*pi/180; w2double=('Enter O2 double dot'); A=[cos(O1), -r3*sin(O3); sin(O1), -r3*cos(O3)]; B=[(-r2*(w2^2)*cos(O2))-(r3*(w3^2)*cos(O3)-r2*w2double*sin(O2));((-r2*(w2^2)*sin(O2))-(r3*(w3^2)*sin(O3)-r2*w2double*cos(O2))]; C=A^-1; D=C*B; r1double=D(1,1) w3double=D(2,1)
'Force analysis' r1=input ('Enter length of ground link'); r2=input ('Enter length of input length'); r3=input ('Enter length of coupler link'); r4=input ('Enter length of slider offset'); O1=input ('Enter O1 angle'); O2=input ('Enter O2 angle'); O3=input ('Enter O3 angle'); O4=input ('Enter O4 angle'); w2=input ('Enter w2'); w3=input ('Enter w3'); r1dot=input ('Enter r1dot'); O1=O1*pi/180; O2=O2*pi/180; O3=O3*pi/180; O4=O4*pi/180; m2=1; m3=1; m4=1; a2=r2/2; a3=r3/2; b2=r2/2; b3=r2/2; I2=m2*((r2)^2)*(1/12) I3=m3*((r3)^2)*(1/12) I4=m4*((r4)^2)*(1/12) F=5;
w2double=('Enter O2 double dot'); A=[cos(O1) , -r3*sin(O3); sin(O1) , -r3*cos(O3)]; B=[(-r2*(w2^2)*cos(O2))-(r3*(w3^2)*cos(O3)-r2*w2double*sin(O2));((-r2*(w2^2)*sin(O2))-(r3*(w3^2)*sin(O3)-r2*w2double*cos(O2)))]; C=A^-1; D=C*B; r1double=D(1,1) w3double=D(2,1) rdoublea=[((-r2/2)*(w2^2)*cos(O2)-(r2/2)*w2double*sin(O2));(r2/2)*(w2)^2*(-sin(O2))+(r2/2)*w2double*cos(O2)] rdoublea2=(rdoublea(1,1)^2+rdoublea(2,1)^2)^.5 rdoubleb=[-r2*(w2^2)*cos(O2)-(r2)*w2double*sin(O2)-(r3/2)*(w3^2)*cos(O3)-(r3/2)*w3double*sin(O3); ((r2)*(w2)^2*(-sin(O2))+(r2)*w2double*cos(O2))-((r3/2)*(w3)^2*(sin(O3))+(r3/2)*w3double*cos(O3))] rdoubleb3=(rdoubleb(1,1)^2+rdoubleb(2,1)^2)^.5 rdoublec=[r1double*cos(O1); r1double*sin(O1)] rdoulbec4=(rdoublec(1,1)^2+rdoublec(2,1)^2)^.5 k=rdoublea(1,1); j=rdoublea(2,1); l=rdoubleb(1,1); m=rdoubleb(2,1); n=rdoublec(1,1); p=rdoublec(2,1); H=[1 0 -1 0 0 0 0 0;0 1 0 -1 0 0 0 0;a2*sin(O2) -a2*cos(O2) b2*sin(O2) -b2*cos(O2) 0 0 0 -1; 0 0 1 0 -1 0 0 0; 0 0 0 1 0 -1 0 0; 0 0 a3*sin(O3) -a3*cos(O3) b3*sin(O3) -b3*cos(O3) 0 0; 0 0 0 0 1 0 cos(45) 0;0 0 0 0 1 0 sin(45) 0] y=[(m2*k); (m2*j+m2*10); (I2*w2double); (m3*l); (m3*m+m3*10); (I3*w3double); (m4*n+F*cos(45)); (m4*p+m4*10+F*sin(45))] G=(H^-1)*y
%Position Analysis Method 3% r2=input ('Enter length of input length'); r3=input ('Enter length of coupler link'); r4=input ('Enter length of slider offset'); O1=input ('Enter O1 angle'); O2=input ('Enter O2 angle'); O4=input ('Enter O4 angle'); O1=O1*pi/180; O2=O2*pi/180; O4=O4*pi/180; a=(r4*cos(O4))-(r2*cos(O2)); b=(r4*sin(O4))-(r2*sin(O2)); P=1; Q=(2*a*cos(O1))+(2*b*sin(O1)); R=(a^2)+b^2-(r3^2); poly1=[P Q R]
roots(poly1) K1=(a+ans*cos(O1)); K2=(b+ans*sin(O1)); O3=atan2((K2),(K1))*180/pi end
%Position analysis Triangle Law% r2=input ('Enter length of input length'); r3=input ('Enter length of coupler link'); r4=input ('Enter length of slider offset'); O1=input ('Enter O1 angle'); O2=input ('Enter O2 angle'); O4=input ('Enter O4 angle'); O1=O1*pi/180; O2=O2*pi/180; O4=O4*pi/180; r2i=r2*cos(O2); r2j=r2*sin(O2); r1i=r1*cos(O1); r1j=r1*sin(O1); r7i=(r2i-r1i); r7j=(r2j-r1j); r7=sqrt((r7i^2) +(r7j^2)) O7=atan(r7j/r7i) if r7j<0 & r7i>0 O7=O7+360 end if r7j<0 & r7i<0 O7=O7+270 end if r7j>0 & r7i<0 O7=O7+180 end O9=O7-O4; r4i=r4*cos(O1); r4j=r4*sin(O1); r3i=(r4i-r7i); r3j=(r4j-r7j); r3=sqrt((r3i^2) +(r3j^2)) O3=atan(r3j/r3i); if r3j<0 & r3i>0 O3=O3+360 end if r3j<0 & r3i<0 O3=O3+270
end if r3j>0 & r3i<0 O3=O3+180 end
%Position analysis Triangle Law% r2=input ('Enter length of input length'); r3=input ('Enter length of coupler link'); r4=input ('Enter length of slider offset'); O1=input ('Enter O1 angle'); O2=input ('Enter O2 angle'); O4=input ('Enter O4 angle'); O1=O1*pi/180; O2=O2*pi/180; O4=O4*pi/180; r2i=r2*cos(O2); r2j=r2*sin(O2); r1i=r1*cos(O1); r1j=r1*sin(O1); r7i=(r2i-r1i); r7j=(r2j-r1j); r7=sqrt((r7i^2) +(r7j^2)) O7=atan(r7j/r7i) if r7j<0 & r7i>0 O7=O7+360 end if r7j<0 & r7i<0 O7=O7+270 end if r7j>0 & r7i<0 O7=O7+180 end O9=O7-O4; r4i=r4*cos(O1); r4j=r4*sin(O1); r3i=(r4i-r7i); r3j=(r4j-r7j); r3=sqrt((r3i^2) +(r3j^2)) O3=atan(r3j/r3i); if r3j<0 & r3i>0 O3=O3+360 end if r3j<0 & r3i<0 O3=O3+270 end if r3j>0 & r3i<0 O3=O3+180
end
%Velocity analysis Instant Centers% r1=input ('Enter length of ground link'); r2=input ('Enter length of input length'); r3=input ('Enter length of coupler link'); r4=input ('Enter length of slider offset'); O1=input ('Enter O1 angle'); O2=input ('Enter O2 angle'); O3=input ('Enter O3 angle'); O4=input ('Enter O4 angle'); w2=input ('Enter w2'); O1=O1*pi/180; O2=O2*pi/180; O3=O3*pi/180; O4=O4*pi/180; I12=[0,0]; I23=[r2*cos(O2);r2*sin(O2)]; I34=[r2*cos(O2)+r3*cos(O3); r2*sin(O2)+r3*sin(O3)]; m1=(I23(2,1))/(I23(1,1)); m2=tan(O4); x=(I34(2,1)-m2*I34(1,1))/(m1-m2); y=x*m1; I13=[x;y] w3=((abs(w2))*sqrt(((I23(2,1))^2)+(((I23(1,1))^2))))/sqrt((((I13(2,1)-I23(2,1))^2)+((I13(1,1)-I23(1,1))^2))) r1dot=((abs(w3)))*sqrt((((I13(2,1)-I34(2,1)))^2)+(((I13(1,1)-I34(1,1)))^2))
%Velocity Analysis Method 2 Loop Closure% r1=input ('Enter length of ground link'); r2=input ('Enter length of input length'); r3=input ('Enter length of coupler link'); r4=input ('Enter length of slider offset'); O1=input ('Enter O1 angle'); O2=input ('Enter O2 angle'); O3=input ('Enter O3 angle'); O4=input ('Enter O4 angle'); w2=input ('Enter w2'); O1=O1*pi/180; O2=O2*pi/180; O3=O3*pi/180; O4=O4*pi/180; A=[cos(O1), r3*sin(O3); sin(O1), -r3*cos(O3)]; B=[-r2*w2*sin(O2); r2*w2*cos(O2)]; C=(A^-1)*B; r1dot=C(1,1) w3=C(2,1)