clear all;

a = 3/4+0.1;
go = @(x)( [x(2,:);a-x(1,:).^2]);

% piirrellään 4-periodiset ratkaisut !


x = roots( [1 0 -2*a 1 (a^2-a)]);
y = roots( [1 0 -2*a 1 (a^2-a)]);

X = [x';y'];

for i=1:1:length(x)
  for j=1:1:length(y)
   
    X = [real(x(i)) ; real(y(j))];
    for k=2:1:5
      X(:,k)=go(X(:,k-1));
    end
    
    hold on;
    plot(X(1,:),X(2,:));
    
  end
end

N = 1000;
M = 10;
X = repmat([1/2;1/2],1,N) + (rand(2,N)-0.5)*0.2;

for i=1:1:M
  for k=1:1:10
    X=go(X);
  end
  
  hold on;
 
 

end

plot(X(1,:),X(2,:),'r*');