Matematik och Datavetenskap, Chalmers Tekniska Högskola och Göteborgs Universitet
Do the matlab exercises week by week. Show your programs and discuss them with your supervisor every week.
The programming exercises are an essential part of the course. Each student must write and keep a full set of programs.
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. Start working on Rickard's matlab exercises.
2. 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)
3. 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. 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 in a style similar to bisec.m.
/stig