Simple MATLAB codes

  • Thread starter Thread starter edward
  • Start date Start date
Joined
4/11/09
Messages
11
Points
11
hello, i am preparing for a numerical analysis exam, and i need to learn some basic matlab codes.
So if any of you can help with the following:
1- Newton's method for solving a non-linear equation
2- Composite Simpson's rule for computing a simple definite integral
3- Second-order Taylor method for solving an ODE

I googled it, but i couldn't find a self-containing code...what i need to learn is a code that contains the functions, the inputs and the outputs, without the need of multiple .m files.

Thank you for the help :D
 
Please find attached functions for Newton method (newton.m) and composite Simpson method (compositeSimpson.m), as well as corresponding test files (newton_test.m and compositeSimpson_test.m). As mentioned in comments, these simple scripts are written according to Burden & Faires "Numerical Analysis" book. I understand you asked for everything related to a method to be into single file, but this is not good practice, and if you still want it, you should be able to easily incorporate functions code inline into the test scripts.
 

Attachments

Back
Top Bottom