Examples of Program Flow Control in MATLAB
Below are various .m files we have used in class to illustrate contitional and itterative statements.
Right click on a file and use "Save Target as" to save the file to your computer.  Under Construction.


Problem
.m File

Square root of positive numbers only
if/elseif/else

Grading curve
nested if


elseif


sequential if


switch

Displaying the quadrant given angle of quadrant diagonal
switch with two value cell arrays

Static friction with switch structure
command line input


input statement input


menu statement input

Square root of a vector for loop with nested if


with concatenated error message
Parallel resistor network
for loop

Inverse factorial
while loop