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= \sqrt{3x-6} , x=5 (answer is 3)

g= \frac{x}{\left|x\right|} ,x=3,x=-3 (answers are 1, -1)

h=2x^{2}-x,x=2 (answer is 6)