Matematik och Datavetenskap, Chalmers Tekniska Högskola och Göteborgs Universitet
Theory: Read Ch xx The Integral.
Exercises: Do the following exercises. ???
Topics: Matlab's online documentation. Function subprograms. Matlab commands: function, plot, fplot, feval. How to document your own matlab programs.
Theory: Read about function subprograms in PE-S. Make yourself acquainted with matlab's online documentation: help, helpwin, helpdesk.
Exercises:
1. Write a function file called funk1.m that computes y=x^2-2 and a
function file called Dfunk1.m that computes the derivative of this
function, i.e., y=2x. Test your programs by computing various
function values and by plotting them in two ways:
* use matlab's program fplot (read the documentation: help fplot)
* generate a vector of x-values and use matlab's program plot (read the
documentation: help colon, help plot)
2. Rewrite your bisection, fixed point iteration, regula falsi, and Newton iteration program as function subroutines. Use bisec.m as a model for writing such a program and how document it. Build your programs on the following program heads: fixpoint.m, regula_falsi.m newton.m.
Test your programs on some well chosen test equations.
Goal: After week 1 each student should have the following programs: bisec.m, regula_falsi.m, fixpoint.m, newton.m, written according to the specifications in the given program heads.
/stig