An
Introduction To Matlab
-
Start Matlab.
You will get a command line workspace with a prompt >>
.
-
You can issue commands
and assign values to variables after this prompt. To define a variable
a,
and give it a value of 17,
do the following
-
Type a
= 17
-
Observe that you will
get a message that a is now given the value of 17.
-
To suppress the print
message add a semi-colon, i.e. type a =
17;,
-
You can perform arithmetic
operations on variables and constants. Operations include:
-
+
Addition
-
-
Subtraction
-
*
Multiplication
-
/
Divison
-
^
Exponentiation
-
You can also define
arrays. Define an array by using square braces and spaces between
values.
-
Type Den
= [1 3 2 0].
-
Note you get the values
printed. To suppress the print add a semi-colon.
-
You can use an array
to represent a polynomial, like a numerator or denominator polynomial in
a transfer function. When you do that, Matlab assumes that the first
entry in the array is the coefficient of the highest power, so Den (above)
would represent:
-
You can get a listing
of all the variables in your workspace by entering a whos
command. That gives you a listing of the variables and the memory
they occupy. Dropping the "s" just gives you the variables.
(Clearly Matlab was initially designed when memory space was much more
precious.
If you want information on some system analysis topics, click
here.