Introduction to matlab

  1. invoking matlab
     a. from the command line just type 

> matlab
          
  2. demonstration of interpreter
     a. > help help
        > help cos
        > help fft
     b. basic numerical computation: 
        > 2 + 3
     c. variables: 
        > x = 3 * 2.01
        > who
     f. ans variable
     g. vectors and matrices
        > x=[1:10]
        > x = [1 3 7 15]
        > y=[1:0.1:10]
        > z=[1:3;4:6;7:9]
     h. matrix vs. pointwise operations: .*, ./, .^
        > z*z
  
3. demonstration of scripting via matlab editor
     a. invoking scripts from matlab
     b. % as comments
     c. ; to suppress output

 
4. useful functions
     a. plotting: plot, subplot, figure, hold, stem, axis, title
     b. math: e=exp(1), pi, sin, cos, atan, sqrt
        > cos(pi)
        > cos(0:0.1:pi)
     c. sound: wavread, wavwrite, auread, auwrite, sound(y,fsamp)

     d. signal processing: filter, firfilt, conv, freqz, fft, remez, 
          fir1, specgram, various window functions
          > z=firfilt(fir1(256,0.05),y)
          > specgram(z)
     e. complex: j, real, imag, abs, angle, zprint, zcat, zvect
        > real(j) % locate a complex number in cartesian form
        > imag(j)
        > abs(j)  % locate a complex number in polar form; see help abs
        > angle(j)
        > zprint(j) % convenient graphing tools
        > zvect(j)
        > zcat([1 j 1+j])

  

5. > exit