1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
//Example 10.1.2 Page 351
//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
//Steven H. Strogatz
clear;
clear;
clc;
close;
set(gca(),"auto_clear","off") //hold on
for x=-4:0.2:4
y1=sin(x);
y2=x;
plot2d(x,y1,style=-2)
plot2d(x,y2,style=-2)
end
disp("By zooming the above graph we observe that only fixed point is x=0.")
lambda=cos(0) //f'(x*)=cos(0)
disp("Since, lambda=1; therefore we can not say about stability of x*=0.")
disp("So, see stability by cobwebs diagram, as shown in book.")
//Cobweb Diagram :-
figure
for x=0:0.1:(%pi/2)
y1=sin(x);
y2=x;
plot2d(x,y1,style=-4)
plot2d(x,y2,style=-4)
end
x0=%pi/2;
for y=0:0.2:sin(x0)
x=x0;
plot2d(x,y,style=-3)
end
dx1=(sin(x0)-x0)/5;
for x=x0:dx1:sin(x0)
y=sin(x0);
plot2d(x,y,style=-3)
end
dy1=(sin(sin(x0))-sin(x0))/5;
for y=sin(x0):dy1:sin(sin(x0))
x=sin(x0);
plot2d(x,y,style=-3)
end
dx2=(sin(sin(x0))-sin(x0))/5;
for x=sin(x0):dx2:sin(sin(x0))
y=sin(sin(x0));
plot2d(x,y,style=-3)
end
x=sin(sin(x0));
dy2=(sin(x)-x)/5;
for y=x:dy2:sin(x)
x=sin(sin(x0));
plot2d(x,y,style=-3)
end
y=sin(sin(sin(x0)));
dx3=-(sin(sin(x0))-y)/5;
for x=sin(sin(x0)):dx3:y
//y=sin(x);
plot2d(x,y,style=-3)
end
xtitle("Cobweb Diagram","x-Axis ( xn)","y-Axis ( xn+1 )")
//End of Example.
|