Animated plots

Miguel Goni Rodrigo, University of South Florida, Mechanical Engineering
Author Profile

Summary

The activity consists on solving simple mechanisms such a slider crank, 3 or 4 bar linkage and plot them in a way that we can see them in motion. It forces the students to learn about fsolve and drawnow as well as the use of for loops.


Learning Goals

The students will learn how to use the fsolve function and animate a plot.

First, they will research about the fsolve function and use solved examples to figure out how to use fsolve and once that is accomplished, they will apply the function to the mechanism in question.

Context for Use

This activity belongs to the sophomore year in college for any class size. I use it as a project for an introductory course to MATLAB.
The students need to know about arrays, for loops and how functions work. They typically need some guidance but they can also access enough information online (MathWorks) or through the help utility in MATLAB.

Description and Teaching Materials

The activity only requires MATLAB. We can use the documentation in the MATLAB library to learn and practice with the relevant functions and then apply them to the mechanisms under study to watch their motion.




Teaching Notes and Tips

The best resource is the help utility within MATLAB. The examples posted online on the Mathworks website are not good enough.

Assessment

I first check and see if they have learned how to use fsolve properly. Since it is a built in function the inputs and outputs are already established and the students must simply follow them. I check for initial conditions and how they introduce the time variable into the function.

Then I check if they are using a for loop and if so, is the use correct. Lastly, I check how they have edited the plot so the mechanism motion can be seen clearly and comfortably.

References and Resources

Mathworks website documentation.

https://www.mathworks.com/help/