% Jake Bobowski
% June 6, 2016
% Created using MATLAB R2014a

% Lines in a MATLAB script (*.m file) that begin using the percent symbol
% are comments.
% It is good practice to thoroughly comment your scripts.
% The small initial investment in time to comment your work will same you
% large amounts of time in the long run.

% You useful command is clearvars.  Suppose that you've been running a
% bunch of scripts in MATLAB and in that process you've assigned some value
% to x, say x = 2.  Then you've finished what you wanted to do and you
% start a new script that is independent of the ones you've been working on
% previously.  Suppose also that you now want to use x for something else.
% You can clear all previous variable assignments by executing 'clearvars':
clearvars

% Addition, subtraction, multiplication, and division

% If you run a script with a 3+5 statement, the Command Window will produce
% an output of 8.
3+5

% You can use a semicolon to suppress the output.  This is useful for long
% outputs that you don't need to see.  To suppress the 8 output from above,
% use the input 3+5;.
3+5;

% Of course, you can assign the output of an operation to a variable.  The
% two line below will result in an output of y = 12.
x = 3+5;
y = 2*x-4

% MATLAB will accept scientific notation as follows:
hbar = 1.05e-34;
omega = 2*pi*1e9;
kB = 1.38e-23;
T = 300;
hbar*omega/(kB*T)

% You can also do powers, roots, and trig functions...
27^3
sqrt(16)
sin(pi/2)
cos(pi/4)
tan(pi/6)
log(100)
log10(100)
exp(1)
ans =

     8


y =

    12


ans =

   1.5936e-04


ans =

       19683


ans =

     4


ans =

     1


ans =

    0.7071


ans =

    0.5774


ans =

    4.6052


ans =

     2


ans =

    2.7183