Some m-files for enee241 students...
The naming scheme I'm using is the number of the homework first then the chapter and problem number.  You can just download these files as text files and run them in MATLAB. I also have this crazy convention (habit, reflex, neurosis... you decide) of making every script a function by putting

function [output]=function_name(input)

as the first line of the script even if there isn't any input or output. My rationale behind this is that if I want to go back later and change the program to accept input or give output it's ready. (And it just seems more mathematical to me to deal with functions) And you can write functions which call each other, which is a nice way of breaking large programs into smaller, more managable ones that you can test individually. And you don't have to use the function "input". And that's all folks...

hw1:
 hw1handout5.m
 hw1_1_9.m

hw2:
hw2_1_12.m
hw2_1_13.m
hw2_1_15.m

hw3:
hw3_2_2.m
hw3_2_6.m
hw3_2_10.m
hw3_2_11.m

hw4:  problem 2.3 is covered by hw3_2_2.m above.
hw4_2_4.m
hw4_2_8.m
hw4_2_13.m
hw4_2_21.m

hw5:
hw5_2_1.m
hw5_2_9.m
hw5_2_14.m
hw5_2_16.m

hw6:
hw6_2_7.m
hw6_2_12.m
hw6_2_17.m : this problem has some major typos in the book

hw7:
hw7extra.m
hw7_3_6.m
fnewton.m
problems using fnewton.m:
f310.m  df310.m
f32.m  df32.m
f33.m  df33.m
f34.m  df34.m
explanation for the strange answers in 3.4: For c=10 one root is at ~1.47 very close to the vertical asymptote in tangent at ~1.57, so the slope of the graph at the root is very steep. With an initial guess of 1.4 we are close enough to the root so that the slope is relatively steep and one step of Newton's method stays on the same side of the asymptote and we converge to 1.47 the closest root. However, with an initial guess of 1.3 the slope of the graph there is relatively flat, and one step of Newton's method crosses the asypmtote ... and further iterates keep moving further right.We end up at ~130 after about 24 steps, this is a root of the function just not the closest root to the initial guess.

hw8:
feuler.m
eulertp.m
f51.m
at the command line >> [t,y]=feuler('f51',[0,10],50,1);
or >> [t,y]=eulertp('f51',[0,10],50,1,10);
f54.m
at the command line >> [t,y]=ode23('f54',[1,4],[1/2,-1/2]);

hw10:
aitken.m
neville.m
for more details on Neville's method try  this

other cool stuff:
related to hw8: coolfields.m    courtesy of Dr. Tobias von Petersdorf (originalvectfield.m vectfieldn.m
NEW and IMPROVED: matrix times circle equals ellipse mtcee.m
 
 
 

 henon