Matlab Assignment 1
- Follow the instructions in Using Matlab for first order ODEs.
Everything you need for this homework is contained on this web page and section 8.3 in "Differential Equations
with Matlab".
- You need to download m-files dirfield.m and Euler1.m
and put them in the same
directory as your m-files. First try out the examples below. Then modify these examples for the homework problems.
Instructions for using dirfield
Example for using Euler1
-
Matlab needs to know where to look for m-files:
- Either use the current folder field in the desktop toolbar (click on the "..." to
the right of the field), see Section 4.1.2 in "Differential Equations with Matlab".
- or use the addpath command, see
How to tell Matlab where to look for m-files
- You MUST prepare the solution for each problem as an m-file, e.g., prob2a.m.
Typing commands at the Matlab prompt ">>" and handing in a hardcopy of this is
NOT ACCEPTABLE.
- You can then use
publish('prob2a') to generate an html file containing commands, output and graphics. You can open this html file
in your web browser and print it from your web browser.
See sections 4.2.3 and 4.4.3 in "Differential Equations with Matlab".
Hints
- Problem 2(b): To solve the initial value problem from
t=0 to t=-5 use ode45(f,[0,-5],y0).
-
Problem 3:
3(a): It is likely that dsolve will not be able to solve this differential equation,
depending on your version of Matlab.
3(b),(c),(d): See the example in
Dealing with solutions in implicit form