Homework 6 - Gene Networks II - Basins of Attraction - First Draft Due 1pm Friday October 5. Final Draft Due 5pm Monday, October 8

Write a function called boa that takes as arguments
        seed,   an 1-by-n vector
        wire,   an n-by-3 matrix
        rule,	an n-by-1 vector
and
(1) finds the attractor that seed is attracted to,
(2) plots the attractor,
(3) finds and plots all states that land in this attractor, and
(4) places seed, wire and rule onto the plot.

You should strive to produce plots such as that on your right. (This is just one of the 3 basins associated with the given wire and rule. The other 2 can be found by starting with different seeds.)

Regarding (1) I recommend writing a subfunction, e.g.,

     function att = getatt(s,wire,ruletab)
that applies last week's work until ns is not really new.
How to tell? Try ismember.
Regarding (2) I recommend sin and cos as used, e.g., way back in our circle deformers of lecture 1. After looking there please look here.
Regarding (3) I recommend that you write a subfunction,
     function spre = pre(s,s1,s2)
that returns all predecessors of state s.
Regarding (4) I recommend the text command, e.g.,
    text(x,y,[num2str(wire(j,:)) '     ' num2str(rule(j))])
where x is likely fixed and y changes with j. It is possible to text off screen in which case you might wish to stretch via axis.

Your work will be graded as follows:

        First draft of boa.m
                2 pts for draft of getatt
                2 pts for plot of att
                2 pts for draft of pre

  PLEASE BE ADVISED: You may brainstorm with others, but you must
                     compose and submit your own draft. Similarly, as
                     your brainstorming leads to code I can imagine
                     that group members submit similar code. I can not
                     imagine how they could submit similar documentation
                     or custom plots.

        Final draft of boa.m
                8 pts for header CONTAINING detailed USAGE
                8 pts for further comments in code 
                4 pts for indentation
                10 pts for correct getatt
                6 pts for correct pre  
                6 pts for correct repeated use of pre  

	        12 pts for 4 (automatically) labeled jpeg plots. 
                   The 1st plot should agree with the six pack above.
                   The 2nd two should be plots of the other two basins
                       associated with the 6-gene ring above all rules = 191.
                   The 4th plot should be for a net of your choosing.
                   Make it big and beautiful. The best will be
                   transported to a new front page gallery - so please
                   use your full name in the title of your jpeg. (I don't
                   mean the `plot' title I mean the `save as' title).

	10 EXTRA CREDIT POINTS for successful coding of pre that 
                implements the non brute force logic from the lecture page.
	        One device for pointing to allowable predecessors is
     
		ind = cell(1,n);
                for j=1:n
                    ind{j} = find(s(j)==ruletab(j,:));
                end