e-Mathematics > Matrix Algebra [Admin]

Get Started

Matlab/Octave is a high-level and batch-oriented language intended for matrix computations. It provides a convenient command line interface for performing numerical experiments. When Matlab/Octave is invoked, the prompt will appear on the command window
>>
Then type at the prompt
>> A = [1 -2 1; 0 2 -8; -4 5 9]
where the semicolons (;) are used as delimiters. Alternatively, you may enter the same data as follows:
>> A = [1 -2 1
0 2 -8
-4 5 9]
In either way the system will promptly produce the formatted output, and recognize it as the matrix
A =
   1  -2   1
   0   2  -8
  -4   5   9
To find the value of “A” interactively, simply type “A” to ask the system.
>> A

Interactive demonstration. You can download

idemo.m

and upload it to the matlab drive/folder. This enables you to run a matlab m-file interactively line by line. In order to do so, you execute

>> A = idemo("example01.m")
if you have the m-file example01.m in the matlab drive.

Display control. The result is always echoed back to the command window, which is helpful in some cases. When you do not want this feature, you can choose to add the semicolon (;) at the end of each statement.

>> A = [1 -2 1; 0 2 -8; -4 5 9];
Now the echoing is suppressed. You may still clutter the screen, and want to clear it all together by using
>> clc

Other important commands. Matlab/Octave has an extensive help facility. In order to get good help you first need to know the name of the command that you want to use. For example,

>> help plot
will display the help text for the plot command. To exit Matlab/Octave, type
>> exit


© TTU Mathematics