Matematiska vetenskaper, Chalmers Tekniska Högskola och Göteborgs Universitet

[hem, vecka 1, vecka 2, vecka 3, vecka 4, vecka 5, vecka 6, vecka 7]

ALA-A, studio 7.1, 2006

Review

1. Repeat and finish all Matlab programs that we have done during the course. Every student should have the following programs.

bisect.m
bisectdemo.m
fixpoint.m
derivative.m
newton.m

Make sure that you have these programs and that you understand them. For each program you should also have some examples that show how to use them. Write down these examples on paper.

Perhaps you should write some of the programs again in order to learn better.

2. Some additional exercises to repeat important stuff.

a. Write a for-loop that creates the following numbers in a column vector.

1/3, 1/9, ..., 1/3^10

b. Create the same numbers without using a loop, in one or two command lines.

c. Write a for-loop that computes the sum of these numbers.

d. Compute the same sum with the Matlab program sum.

3. And a final word: Never use the commands input, display, plot, in the Matlab computational functions that you write. (Except perhaps for displaying an error message if the computation must be stopped.) The input and output to a function should go via the input and output variables, for example, x and y in y=funk(x). And the plotting is a separate task that should be done after the function has been called, usually in a script file or on the command line.

/stig