ALA C, 2003-04, Matlab exercise 1

 

[Kurssidan, vecka 1, vecka 2, vecka 3, vecka 4, vecka 5, vecka 6, vecka 7, Matlab]

for loop

Remember the program my_int.m. Change the program so that it uses a for loop instead of the while loop.

Hint:

for i=1:N

end

Debugging: choose a very simple test example and a large step so that the program will only take a few steps, for example 2 or 3 steps. Remove all semicolons in the program and run it. Do exactly the same calculations by hand with pencil and paper and compare with what the computer does. Do this until you understand everything.


Editor: Stig Larsson
Last modified: Sun Jan 18 21:18:16 MET 2004