Matematik och Datavetenskap, Chalmers Tekniska Högskola och Göteborgs Universitet

TMA740B Analys i en variabel Kf Kb, del B, 1999, matlab 1

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. 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


Last modified: Wed Oct 20 17:41:06 MET DST 1999