How do I launch
MatLab?
- Login to the main server engsoc.org
- Run MatLab
This program is actually a free replacement to Matlab called Octave.
It is licensed under the GPL and more information is available at
http://www.octave.org.
Now to get started. How do I perform matrix reductions in MatLab?
- Run MatLab
- Enter your matrix
into matlab like this:
a = [1 2 3; 4 5 6; 7 8 9] |
- Generate the Row Reduced Echleon Form like so:
- The result is this:
b =
1.00000 0.00000 -1.00000
0.00000 1.00000 2.00000
0.00000 0.00000 0.00000 |
How do I add matricies?
- Launch MatLab
- Enter your matrix
into matlab like this:
a = [1 2 3; 4 5 6; 7 8 9]
b = [7 8 9; 1 2 3; 4 5 6] |
- Add the two like this:
- The result is this:
c =
8 10 12
5 7 9
11 13 15 |
How do I subtract matricies?
- Launch MatLab
- Enter your matrix
into matlab like this:
a = [1 2 3; 4 5 6; 7 8 9]
b = [7 8 9; 1 2 3; 4 5 6] |
- Add the two like this:
- The result is this:
How do I do a pointwise multiplication of two matricies?
- Launch MatLab
- Enter your matrix
into matlab like this:
a = [1 2 3; 4 5 6; 7 8 9]
b = [7 8 9; 1 2 3; 4 5 6] |
- Add the two like this:
- The result is this:
c =
7 16 27
4 10 18
28 40 54 |
How do I do a matrix multiplication?
- Launch MatLab
- Enter your matrix
into matlab like this:
a = [1 2 3; 4 5 6; 7 8 9]
b = [7 8 9; 1 2 3; 4 5 6] |
- Add the two like this:
- The result is this:
c =
21 27 33
57 72 87
93 117 141 |
How do I do a pointwise division of two matricies?
- Launch MatLab
- Enter your matrix
into matlab like this:
a = [1 2 3; 4 5 6; 7 8 9]
b = [7 8 9; 1 2 3; 4 5 6] |
- Divide like this:
- The result is this:
c =
0.14286 0.25000 0.33333
4.00000 2.50000 2.00000
1.75000 1.60000 1.50000 |
How do I do a matrix division?
- Launch MatLab
- Enter your matrix
into matlab like this:
a = [1 2 3; 4 5 6; 7 8 9]
b = [7 8 9; 1 2 3; 4 5 6] |
- Divide like this:
- The result is this:
c =
-0.16667 0.83333 0.33333
0.33333 0.33333 0.33333
0.83333 -0.16667 0.33333 |
How do I find the inverse matrix?
- Launch MatLab
- Enter your matrix
into matlab like this:
a = [1 2 3; 4 5 6; 7 8 9] |
- Invert the matrix like this:
- The result is this:
b =
3.1522e+15 -6.3044e+15 3.1522e+15
-6.3044e+15 1.2609e+16 -6.3044e+15
3.1522e+15 -6.3044e+15 3.1522e+15 |
How do I plot a graph?
- If you're in PAL/Leos:
- If you're using any other UNIX machine run this command:
This is needed to view the graph.
- If you're using a Windows machine, you have to save the plot to a file
- Launch MatLab.
- Run these commands to generate this plot
a = [0 1 2 3 4 5 6 7 8 9];
b = sin(a);
plot(b); |
- Run these commands to generate this plot
a = [0 1 2 3 4 5 6 7 8 9];
b = sin(a);
plot(b,'.'); |
- Run these commands to generate this plot
a = [0 1 2 3 4 5 6 7 8 9];
b = sin(a);
plot(b,'x'); |
How do I import a plot into my report?
- Launch MatLab.
- Execute these commands before any others:
gset terminal png;
gset output "myPlot.png"; |
where myPlot.png the is name of the file to create everytime the plot() command is called.
- After you use the plot() command, quit MatLab and run this command:
mv myPlot.png ~/public_html |
where myPlot.png the is name of the file created in MatLab when the plot() command was called.
- Assuming you're using MicrosOft Word
- Insert --> Picture --> From file
- Enter this File name:
http://www.engsoc.org/~username/myPlot.png |
where username is your EngSoc username.
How do I exit MatLab?
- Execute this command: