Graphics Programs Reference
In-Depth Information
Figure2-1: MATLABOutput.
and “ ˆ ” to exponentiate. For example,
>> 3ˆ2 - (5 + 4)/2 + 6*3
ans =
22.5000
MATLAB prints the answer and assigns the value to a variable called ans .
If you want to perform further calculations with the answer, you can use the
variable ans rather than retype the answer. For example, you can compute
the sum of the square and the square root of the previous answer as follows:
>> ansˆ2 + sqrt(ans)
ans =
510.9934
Observe that MATLAB assigns a new value to ans witheachcalculation.
To do more complex calculations, you can assign computed values to variables
of your choosing. For example,
>> u = cos(10)
u=
-0.8391
Search WWH ::




Custom Search