Homework 4. For
This converges to a single value for some values of
Use the “matrix-at-a-time” notation we learned in the last iteration example:
- Start with a vector of
values, and a vector of values (both row vectors and the same size). - Perform many (how many?) iterations on the whole vector of
values, so that each place in the vector is updated according to its appropriate . - Plot the resulting
-values vs. the values. - Continue the iteration and plot several more iterations (how many?).
- Observe the nice pattern that arises, and explore its self-similarity properties.
Hint 1: (Am I getting the right answer?) The result should look something like this:

Graphing an iterative function.
Hint 2: (Code takes forever) If your code is running very slowly, you should consider updating all the orbits (one for each
Hint 3: (Getting a similar plot, but not quite) You should only plot the late elements, so perhaps iterate without plotting for some time (maybe 1000 iterations?) and then plot successive elements of the orbit (say 100?).
Hint 4: (I don’t have so many points in my plot) Be sure to use hold on
so that each plot doesn’t erase the previous ones.
More ideas:
- Find how to make the plot have small dots as markers.
- Can you allow the user to “zoom in” on your plot? Once asked to see a region smaller than
you should probably increase the “density” of your measurements, and confine the plotting of the points so that only the requested ’s are plotted.
§a limit cycle is an orbit of an iterative map that the dynamics of the problem converges to, regardless of the initial condition.