## My first logistic bifurcation curve and a bit more

I don’t know since when, but I desperately want to learn how do I make a logistic bifurcation curve. And now, I finally able to create one. I do not want to forget this ability therefore I post this post, just in case I forget.

Logistic map is one of discrete dynamical systems, represented in the following:

.

It is basically a recursive sequence. It looks simple but it is highly not.When the sequence generated will always be inside the interval [0,4].More specifically, when , the sequence converges to a point. When is varied, does the solution still converge to some point?

In fact, when we vary past 3 we have the situation that is best explained through the following figure:

The figure is saying when is just past 3, the sequence is no longer converging to a point. This phenomena is called a period-doubling, as the sequence now tends to alternatingly approaching two points. However, this is the code to create the above figure in Matlab.

clear; clc;

a = 3:0.005:4; %interval of parameter

x0 = 0.5; %initial condition

N=500; %number of iterations

x(1) = x0; %the first entry is the initial condition

%computation of the orbit

figure(3);hold on;

for i=1:length(a)

for j=2:N

x(j) = a(i)*x(j-1)*(1-x(j-1));

end

y = x(301:end);

plot(a(i),y);

end

hold off

clear

Okay, the fitst task is done. Let us now learn how to make a movie in Matlab. I choose the topic ‘coweb’ as an example. Coweb arises in our topic, which is a discrete dynamical system.

Here is the video

The coweb created in the above movie uses . This exactly where the chaotic dynamic occurs. Therefore, we do not see any pattern there. The iteration that I used is only 90. However, we already see that the sequence makes such a complicated figure.

The code to create such a video is the following.

`clc;clear;`

myu = 3.9; %initial parameter

maxiter = 90; %maximum iteration

xo = 0.4; %initial condition

aviobj = avifile ( 'logistik2.avi', 'fps', 3 );%create a file logistik2.avi

x = 0:0.01:1; %range of x data

y1 = myu.*x.*(1-x); %range of y data to graph y=myu(x-x^2)

y2 = x; %range for y data to graph y=x

figure(1);hold on; %open figure window and hold on

axis([0 1.1 0 1.1]) % set the y and x axis

plot(x,y1); %plot the graph of y=myu(x-x^2)

plot(x,y2); %plot the graph of y=x

frame = getframe ( gca ); %command 1 to store what is inside figure 1

aviobj = addframe ( aviobj, frame ); %command 2

xbaru = myu.*xo.*(1-xo);

z2 = 0:0.01:xbaru;

z1 = xo;

plot(z1,z2);

frame = getframe ( gca );

aviobj = addframe ( aviobj, frame );

fprintf('the fixed point is %f',(myu-1)/myu);

for i=2:maxiter

if(xbaru > xo)

y1 = xo:0.01:xbaru;

else

y1 = xbaru:0.01:xo;

end

y2 = xbaru;

plot(y1,y2);

frame = getframe ( gca );

aviobj = addframe ( aviobj, frame );

xo = xbaru;

xbaru = myu.*xo.*(1-xo);

if(xbaru > xo)

y1 = xo:0.01:xbaru;

else

y1 = xbaru:0.01:xo;

end

y2 = xo;

plot(y2,y1);

frame = getframe ( gca );

aviobj = addframe ( aviobj, frame );

end

hold off;

H = (myu-1)/myu;

fprintf('please press any key \n');

aviobj = close ( aviobj );

%pause;

%close all;

However, I really really want to learn how to convert this avi video produced by Matlab to a gif image format. So if anyone know how do I do this please let me know.

## Your says