% MATLAB EXPLANATION
%
% Example 1 - Introduction
%
% A percent sign at the beginning of a line indicates that the entire line
% will be a "comment".  It is a good idea to distribute comments throughout
% your program to document what each part of the program accomplishes.

% In MATLAB, all variables are double precision floating decimal numbers.

% In MATLAB, an array or a matrix looks like any other variable name.
% A matrix has elements in rows and columns.  Each element in a row is 
% separated by a semincolon, while each element in different columns are
% separated by a comma.

% This problem illustrates solving the following three equations
% simultaneously:

%  x +  y -  z = -1
%  x + 2y + 3z = 9
% 2x -  y - 2z = 4

% We define Matrix A and Matrix B

A = [1,1,-1;
    1,2,3;
    2,-1,-2];

% In Matrix A, the first row contains three elements:  1, 1, -1
% In Matrix A, the first column contains three elements:  1, 1, 2

B = [-1;9;4];

% Matrix B has 3 rows and 1 column, and so B is a 3 x 1 matrix.

C = A\B

% To have MATLAB solve this problem, Select "Run" from the editor bar.
% Alternatively, type the file name on the command line, as long as MATLAB
% can find the program, because it is in the correct "path".
% A semicolon at the end of a line will prevent that variable from being
% printed.

%  The output of this problem is
%
%  C =
%
%     4
%    -2
%     3
