WebMail
WebMail

FAQ


How do I launch MatLab?
  1. Login to the main server engsoc.org
  2. Run MatLab
    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?

  1. Run MatLab
  2. Enter your matrix
    1 2 3
    4 5 6
    7 8 9
    into matlab like this:
    a = [1 2 3; 4 5 6; 7 8 9]
  3. Generate the Row Reduced Echleon Form like so:
    b = rref(a)
  4. 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?
  1. Launch MatLab
  2. Enter your matrix
    1 2 3
    4 5 6
    7 8 9

    7 8 9
    1 2 3
    4 5 6
    into matlab like this:
    a = [1 2 3; 4 5 6; 7 8 9]
    b = [7 8 9; 1 2 3; 4 5 6]
  3. Add the two like this:
    c = a + b
  4. The result is this:
    c =
    
       8  10  12
       5   7   9
      11  13  15
How do I subtract matricies?
  1. Launch MatLab
  2. Enter your matrix
    1 2 3
    4 5 6
    7 8 9

    7 8 9
    1 2 3
    4 5 6
    into matlab like this:
    a = [1 2 3; 4 5 6; 7 8 9]
    b = [7 8 9; 1 2 3; 4 5 6]
  3. Add the two like this:
    c = a - b
  4. The result is this:
    c =
    
      -6  -6  -6
       3   3   3
       3   3   3
How do I do a pointwise multiplication of two matricies?
  1. Launch MatLab
  2. Enter your matrix
    1 2 3
    4 5 6
    7 8 9

    7 8 9
    1 2 3
    4 5 6
    into matlab like this:
    a = [1 2 3; 4 5 6; 7 8 9]
    b = [7 8 9; 1 2 3; 4 5 6]
  3. Add the two like this:
    c = a .* b
  4. The result is this:
     c =
     
        7  16  27
        4  10  18
       28  40  54
How do I do a matrix multiplication?
  1. Launch MatLab
  2. Enter your matrix
    1 2 3
    4 5 6
    7 8 9

    7 8 9
    1 2 3
    4 5 6
    into matlab like this:
    a = [1 2 3; 4 5 6; 7 8 9]
    b = [7 8 9; 1 2 3; 4 5 6]
  3. Add the two like this:
    c = a * b
  4. The result is this:
    c =
    
       21   27   33
       57   72   87
       93  117  141
How do I do a pointwise division of two matricies?
  1. Launch MatLab
  2. Enter your matrix
    1 2 3
    4 5 6
    7 8 9

    7 8 9
    1 2 3
    4 5 6
    into matlab like this:
    a = [1 2 3; 4 5 6; 7 8 9]
    b = [7 8 9; 1 2 3; 4 5 6]
  3. Divide like this:
    c = a ./ b
  4. 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?
  1. Launch MatLab
  2. Enter your matrix
    1 2 3
    4 5 6
    7 8 9

    7 8 9
    1 2 3
    4 5 6
    into matlab like this:
    a = [1 2 3; 4 5 6; 7 8 9]
    b = [7 8 9; 1 2 3; 4 5 6]
  3. Divide like this:
    c = a / b
  4. 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?
  1. Launch MatLab
  2. Enter your matrix
    1 2 3
    4 5 6
    7 8 9
    into matlab like this:
    a = [1 2 3; 4 5 6; 7 8 9]
  3. Invert the matrix like this:
    b = inv(a)
  4. 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?
  1. If you're in PAL/Leos:
  2. If you're using any other UNIX machine run this command:
    xhost +engsoc.org
    This is needed to view the graph.
  3. If you're using a Windows machine, you have to save the plot to a file
  4. Launch MatLab.
  5. Run these commands to generate this plot
    a = [0 1 2 3 4 5 6 7 8 9];
    b = sin(a);
    plot(b);
  6. Run these commands to generate this plot
    a = [0 1 2 3 4 5 6 7 8 9];
    b = sin(a);
    plot(b,'.');
  7. 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?
  1. Launch MatLab.
  2. 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.
  3. 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.
  4. Assuming you're using MicrosOft Word
    1. Insert --> Picture --> From file
    2. Enter this File name:
      http://www.engsoc.org/~username/myPlot.png
      where username is your EngSoc username.
How do I exit MatLab?
  1. Execute this command:
    quit