Now that we understand how to create simple scripts and functions in Matlab we are going to move onto looking at how we can start to create more powerful functions and scripts by using loops. Loops allow us to ask a script or function to repeat a task, or a series of tasks, multiple times with either the same or different inputs each time though the we pass through the loop.

The following videos will introduce the concept of a for loop (we will look at another type of loop, the while loop, next week). Try to re-create the functions written in these videos for yourself. In the lab we will be working in small groups to build upon what you have learnt and write some functions of your own using for loops.

Video 5: For Loops



Video 6: Vectors and Matrices in Matlab



Video 7: Using functions to create vectors



Video 8: More For Loops and Functions

Last modified: Saturday, 8 August 2020, 10:25 PM