====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:fall-2012:math445:lab7 [2012/10/31 19:16] gibson |
gibson:teaching:fall-2012:math445:lab7 [2012/10/31 19:34] (current) gibson |
||
---|---|---|---|
Line 64: | Line 64: | ||
your plots look better. If you use ''pause(0.5)'', Matlab will pause | your plots look better. If you use ''pause(0.5)'', Matlab will pause | ||
just half a second, instead of waiting for you to hit return. | just half a second, instead of waiting for you to hit return. | ||
+ | |||
+ | **Better idea:** put the ''figure(1)'' command outside the for-loop, in the | ||
+ | initialization portion of your code. | ||
**7.** You should now be able to run the code. If not debug it so that you | **7.** You should now be able to run the code. If not debug it so that you | ||
Line 88: | Line 91: | ||
might be easier) is plotted and then ''hold off'' after the last point is | might be easier) is plotted and then ''hold off'' after the last point is | ||
plotted. | plotted. | ||
+ | |||
+ | **Better idea**: Calculate four sparse matrices L1, L2, L3, L4, which are nonzero | ||
+ | wherever L is live and has 1, 2, 3, and 4 or more live neighbors, respectively. | ||
+ | Then plot all the nonzero entries of L1 with red, of L2 with blue, L3 with green, | ||
+ | and L4 with ''[0.5 0 0.5]''. | ||
**10.** Change the orange color in the above plots to purple. What is the | **10.** Change the orange color in the above plots to purple. What is the |