• Matlab Assignment 2 (PDF), due Fri Dec. 2
    You need to download vectfield.m and put this file in the same directory as your m-files.
    If you are using a WAM PC: Say that your m-files are in the folder homework1 in "My Documents". On the WAM system this folder is H:\mydocuments\homework1 . At the beginning of your Matlab session enter
    addpath('H:\mydocuments\homework1')

    and then Matlab will be able to find the m-files in this directory (see Common Problems with Matlab).
    Hints:

    • Problem 1
      (b): Read Using the Euler Method in Matlab
      (c): The default tolerances of ode45 are 1e-3 for RelTol, 1e-6 for AbsTol. You can tell Matlab to use smaller tolerances by
      opt=odeset('RelTol',1e-4,'AbsTol',1e-7);
      [ts,ys]=ode45(...,opt)

      (where "..." are the normal arguments of ode45).

    • Problem 2: Read Solving ODEs using the Laplace Transform in Matlab .
    • Problem 3
      (a): Example: [V,D]=eig(sym([1,2;3,2])) returns a matrix V which has the two eigenvectors as its columns, and a matrix D with the eigenvalues on the diagonal.
      (b): Example: [y1s,y2s]=dsolve(Dy1=y1+2*y2','Dy2=3*y1+2*y2','t')
      (c): You can define f by f = inline('[1,2;3,2]*y','t','y').
      Read the section "Plotting Vector Fields and Trajectories" in Using Matlab for Autonomous Systems.