(5/5)

Project (150 points + 30 points Extra credit)

Four-bar or four-link mechanisms are used in a variety of applications of mechanical engineering. This

project will develop a GUI for users to study four-bar mechanisms shown in the figure below. The inputs

are the length of various links as well as the angle 𝜃2, the angular velocity 𝜃2

̇ and the angular

acceleration 𝜃2

̈.

1. (30 points) Derive the expressions for 𝜃3 and 𝜃4 in terms of 𝜃2 using the geometry shown in the

figure. This process will yield two equations are non-linear and can’t be cast in the form Ax = b.

Also derive the expressions for 𝜃3

̇ and 𝜃4

̇

in terms of 𝜃2

̇ and the expressions for 𝜃3

̈ and 𝜃4

̈ in

terms of 𝜃2

̈. These equations are linear and can be written as Ax = b.

2. (35 points) Develop your own function to solve a system of nonlinear equations. The code must

behave similar to MATLAB’s fsolve. Use your version to solve for 𝜃3 and 𝜃4 in terms of the

known angle 𝜃2. The function has the following format: root = myFsolve(fun, x0). fun

is the name of the function file containing the simultaneous equations, and x0 is a vector

containing the initial guesses. You will get full credit if your function works for two simultaneous

equations. You will receive extra credit (30 points) if your function for arbitrary number of

simultaneous equations.

3. (35 points) You must use your own version of fsolve to solve for 𝜃2 and 𝜃3. Also use your

code for solving linear system of equations (the LU decomposition that you developed in Lab 6).

Use this to solve for 𝜃3

̇ and 𝜃4

̇

in terms of 𝜃2

̇

. You also can use the same code to solve for 𝜃3

̈ and

𝜃4

̈ in terms of 𝜃2

̈ . You will receive half credit if you use MATLAB’s in-built functions for this.

4. (50 points) The user interface must have at least the following functionalities:

1. The user must be able to enter the values of 𝑟1, 𝑟2, 𝑟3 ,𝑟4 , 𝜃̇

2, 𝜃2

̈ .

2. The user interface must have a figure window that draws the mechanism. The user should

be able to press a button so that the window displays an animation as link 2 rotates. i.e. as

𝜃2 varies from 0 degrees to 360 degrees. Depending on the value of the lengths, you may

find that the solutions are complex. If that’s the case, then you can skip those values. As

they represent positions that are not feasible.

3. It must have a second axis window where the angles 𝜃3 and 𝜃4 can be plotted as a function

of 𝜃2. On the same plot, it should also be able to plot 𝜃3

̇

, 𝜃4

̇

, 𝜃3

̈, 𝜃̈

4. The user must be able to

select one or more of the variables to plot on the graph. Make sure that the vertical axis is

properly scaled.

4. Do some error checking. For example, you must make sure that all the lengths are positive.

You must also make sure that 𝑠 + 𝑝 + 𝑞 > 𝑙 where 𝑠 is the length of the shortest link, 𝑙 is

the length of the longest link, 𝑝 and 𝑞 are the length of the other links. The user should be

alerted of these errors.

5. (Extra credit) Feel free to add other bells and whistles as you deem fit. The GUI should be

aesthetically pleasing, user-friendly and intuitive to use.

Use these values to test your program:

𝑟1 (cm) 𝑟2 (cm) 𝑟3 (cm) 𝑟4 (cm) 𝜃2 (deg) 𝜃2

̇ (rad/s) 𝜃̈

2 𝑟𝑎𝑑 𝑠

−2

1 8.0 3.5 10.0 9.0 15 36.7 0

2 5.0 1.0 4.0 3.0 30 30 0

3 8.0 2.0 5.0 4.0 60 45 0

4 10.0 32.0 20.0 20.0 120 -50 40

5 5.0 1.0 6.0 4.0 210 100 -40

Answer for 1:

𝜃3 = 53.0°, 𝜃4 = 81.0°, 𝜃̇

3 = −25.0

𝑟𝑎𝑑

𝑠

, 𝜃4

̇ = −18.7

𝑟𝑎𝑑

𝑠

, 𝜃̈

3 = 908 𝑟𝑎𝑑

𝑠

2

, 𝜃̈

4 = 1700 𝑟𝑎𝑑/𝑠

2

TURN IN ONLINE: The MATLAB files for the GUI and the files containing code for position, velocity and

acceleration analysis as well as your version of fsolve and the Gaussian elimination code.

Recommended Procedure

1. Derive the equations by hand. Be neat.

2. Use MATLAB’s in-built functions to solve for the equations for the values shown above and then

for all values of the input variable 𝜃2.

3. Go through the notes to learn about Newton-Raphson’s method for 2D problems. Then write

the function just for 2D.

4. Once this works, then write the code for a general set of simultaneous equations.

5. Then develop the GUI.

(5/5)

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of