function bifurkacija(xmin,xmax,rmin,rmax,n)
%Bifurkacioni dijagram

% bifurkacija(0,1,2.5,4,100)
% bifurkacija(0.7,0.9,3.4,3.8,100) % "zumirano"

r=linspace(rmin,rmax);
hold on

for k=1:length(r)
    x(1)=0.5;
    for j=1:n
        x(j+1)=r(k)*x(j)*(1-x(j));
        if j>0.8*n && x(j)>xmin && x(j)<xmax
            plot(r(k),x(j),'b.');
        end
    end
end

title('bifurkacija')
xlabel('r')
ylabel('x')