Practical 2: Variables, Script M-files and Graphing

Variables

Functions

 

> Use MATLAB to evaluate the following functions at the given values of x. Type in the command clear x beforehand.

f=3x6,x=5 (answer is 3)

g=x|x|,x=3,x=3 (answers are 1, -1)

h=2x2x,x=2 (answer is 6)