"

Appendix B – Example Applications

This appendix contains a number of problems that were given as application assignments or final projects in an intermediate MATLAB programming course for engineering students. For each problem, there is a problem statement or assignment document and a solution, as a script or live script. You are encouraged to code the problem from scratch and refer to the solution only for guidance when needed. Consider creating a graphical user interface in App Designer as well. The assignment documents may contain submission requirements specific to the particular course in which they were assigned – you may ignore those instructions.

Most of these topics involve time-dependent simulations, implemented by a simple Euler method. Another interesting challenge would be to write an alternative solution using ode45 or ode23.

 

  1. Simulating a Temperature Controller

assignment document: Application 3_ Branching & Looping_2021.pdf

solution: temperature_measurement.m temp_test.m PID.m

 

2. Simulation of an Automobile Cruise Control

assignment document: cruise control.pdf

solution: auto_with_cruise.mlx    PID.m

 

3. Simulating a Trip Around the Moon

assignment document: Final_Project_lunar_2020.pdf

solution: FinalProject2020_moon.m

 

4. Integrated Pest Management Simulation

assignment document: Integrated Pest Management.pdf

solution: IPM.mlx

 

5. Traffic Model by Cellular Automata

assignment document: Traffic Model.pdf

solution: traffic_intersection_light.m

 

6. Open-loop Simulation of a Stirred-Tank Chemical Reactor

assignment document: chem reactor.pdf

solution: chem_reactor.mlx

 

7. Autonomous Steering Simulation

assignment document: autonomous steering.pdf

solution: steering.mlx

 

8. Two- and Three-Compartment Models of Pharmacokinetics

assignment document: Application 6 – Simulation – 2-compartment model.pdf

solutions: two_compartment.m, three_compartment.m

 

9. Active Vehicle Suspension System Simulation

assignment document: active suspension.pdf

solution: active_suspension.mlx

 

10. Simulation of a Rising Air Bubble

assignment document: Bubble Simulation.pdf

solution: air_bubble_Newtonian_RevA.m

 

11. SIR Model of Infectious Disease

assignment document: Application 6_ SIR.pdf

solution: SIR_model.m

 

12. Simulating a High-Altitude Balloon Flight

assignment document: Final Project Sp 2021.pdf

solution: balloon_sim.m

 

These two assignments deal with a classic computer science problem, the Tower of Hanoi. In #13, you are asked to write a program to allow a human player to play the game. Some simple graphics code is provided. In #14, you are asked (more in the spirit of a computer science course) to devise a recursive program to enable the computer to solve the game automatically. You are provided with an app containing the game code and are only asked to write the callback function for the Solve button. Explanatory videos are provided to guide you in the right direction.

 

13. Tower of Hanoi Game

assignment document: Application 6_ Cell & Struct Arrays 2020.pdf

supporting file: display_tower.m

explanatory video:  https://mediasite.osu.edu/Mediasite/Play/31f1198d45c14bf0b44d4e891b7d56921d

solution: application6_2020.m move.m

 

14. Tower of Hanoi Solver

assignment document: EWA05A.pdf

template app: Hanoi_GUI_template.mlapp

explanatory videos: GMT20241018-110116_Recording_1920x1020.mp4 GMT20241018-113446_Recording_1920x1020.mp4

solution: Hanoi_GUI.mlapp

License

Icon for the Creative Commons Attribution-NonCommercial 4.0 International License

MATLAB Programming for Engineering Applications Copyright © 2025 by The Ohio State University is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License, except where otherwise noted.