Practical 2: Variables, Script M-files and Graphing

Comments in MATLAB

Exercise

 

> Type in the following line (including the comment):

t = 9 % sets time variable equal to 9

> Then add a comment to the next line, which finds the acceleration at time t.

a = 15*sqrt(t) % <add your comment here>

 

 

Comments as good coding practice

Soon, the code you will be able to write will become much more complicated. You will need to add comments to make it easier for both you and others to read.