Creating Variables To MATLAB
Creating Variables To MATLAB
Creating Variables To MATLAB
EDU>> pi
Variables
You can even create your own variables. Try this:
EDU>> radius = 4
x = 73.65
What happens?
The old value for x (10.57) is replaced by the new value (73.65)
Also, since the semicolon was left off the end, we see the result
in the command window (as well as in the workspace window)
Exercise 2
1. In MATLAB create two variables: a = 4 and b = 17.2
2. Now use MATLAB to perform the following set of
calculations:
5a
Creating Strings (Text Variables)
Variable do not have to be numbers. At the MATLAB command
prompt type:
month = ‘August’
What happens?