diff options
Diffstat (limited to '27')
121 files changed, 2321 insertions, 0 deletions
diff --git a/27/CH10/EX10.1.1/Example_10_1_1.sce b/27/CH10/EX10.1.1/Example_10_1_1.sce new file mode 100755 index 000000000..a738356d6 --- /dev/null +++ b/27/CH10/EX10.1.1/Example_10_1_1.sce @@ -0,0 +1,40 @@ +//Example 10.1.1 Page 350
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+
+x=poly(0,"x");
+f = (x^2)-x; //Defining Polynomial--> x(dot)=x^2 -1. Let this be f(x)
+disp("Fixed Points are :")
+y = roots(f)
+
+lambda1=evstr(2*y(1))
+lambda2=evstr(2*y(2))
+
+//if lambda1<1 then
+ // disp(y(1))
+ //disp("Stable.")
+//elseif lambda1>1
+ // disp(y(1))
+ //disp("Unstable.")
+//else
+// disp("Unconclusive since lambda=1.")
+//end
+
+//if lambda2<1 then
+// disp(y(2))
+// disp("Stable.")
+//elseif lambda2>1
+// disp(y(2))
+// disp("Unstable.")
+//else
+// disp("Unconclusive since lambda=1.")
+//end
+
+disp("Since lambda1=0<1, Thus it is stable.")
+disp("Since lambda2=2>1 Thus it is unstable.")
+
+//End of Example.
diff --git a/27/CH10/EX10.1.2/10_1_2.jpg b/27/CH10/EX10.1.2/10_1_2.jpg Binary files differnew file mode 100755 index 000000000..0765eb80e --- /dev/null +++ b/27/CH10/EX10.1.2/10_1_2.jpg diff --git a/27/CH10/EX10.1.2/10_1_2_2.jpg b/27/CH10/EX10.1.2/10_1_2_2.jpg Binary files differnew file mode 100755 index 000000000..971990e91 --- /dev/null +++ b/27/CH10/EX10.1.2/10_1_2_2.jpg diff --git a/27/CH10/EX10.1.2/Example_10_1_2.sce b/27/CH10/EX10.1.2/Example_10_1_2.sce new file mode 100755 index 000000000..5c3a988bc --- /dev/null +++ b/27/CH10/EX10.1.2/Example_10_1_2.sce @@ -0,0 +1,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.
\ No newline at end of file diff --git a/27/CH10/EX10.3.1/10_3_1.jpg b/27/CH10/EX10.3.1/10_3_1.jpg Binary files differnew file mode 100755 index 000000000..fa52c90d7 --- /dev/null +++ b/27/CH10/EX10.3.1/10_3_1.jpg diff --git a/27/CH10/EX10.3.1/Example_10_3_1.sce b/27/CH10/EX10.3.1/Example_10_3_1.sce new file mode 100755 index 000000000..838018893 --- /dev/null +++ b/27/CH10/EX10.3.1/Example_10_3_1.sce @@ -0,0 +1,45 @@ +//Example 10.3.1 Page 357
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//Taking r=2;
+r=2;
+x=poly(0,"x");
+f = x-2*(x^2); //Defining Polynomial--> f(x*)-x* = 2*x(1-x)-x. Let this be f(x)
+disp("Fixed Points are :")
+y = roots(f)
+
+disp("The fixed point x*=1-(1/r) does not exists for r<1, Since x(n+1)<0 and population cannot be negative.")
+
+lambda1=r-2*r*y(1) //f'(x*) = r-2rx*
+lambda2=r-2*r*y(2)
+
+disp("Since, lambda1=2>1, thus orign is Unstable.")
+disp("Since, lambda2=0<1, thus x*=1-(1/r) is Stable.")
+
+//Number of points graphically :
+
+r1=3; //r>1
+r2=1; //r=1, tangential case
+r3=0.5; //r<1
+
+for xn=0:0.05:1
+ xn_one=r1*xn*(1-xn);
+ plot2d(xn,xn_one,style=-3)
+ xn_one=r2*xn*(1-xn);
+ plot2d(xn,xn_one,style=-3)
+ xn_one=r3*xn*(1-xn);
+ plot2d(xn,xn_one,style=-3)
+ y=xn; // to draw y=x line
+ plot2d(xn,y,style=-4)
+end
+xtitle("Graph Showing Number of Fixed Points for differnent values of r","x-Axis ( xn )","y-Axis ( xn+1 )")
+
+//Similarly, check for Stability by changing r.
+
+//End of Example.
\ No newline at end of file diff --git a/27/CH10/EX10.3.2/10_3_2.jpg b/27/CH10/EX10.3.2/10_3_2.jpg Binary files differnew file mode 100755 index 000000000..d983e8a41 --- /dev/null +++ b/27/CH10/EX10.3.2/10_3_2.jpg diff --git a/27/CH10/EX10.3.2/Example_10_3_2.sce b/27/CH10/EX10.3.2/Example_10_3_2.sce new file mode 100755 index 000000000..fd50a5435 --- /dev/null +++ b/27/CH10/EX10.3.2/Example_10_3_2.sce @@ -0,0 +1,18 @@ +//Example 10.3.2 Page 358
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//Taking r=3.5 such that r>3 as given in book.;
+r=3.5;
+for x=0:0.01:1
+ f2x=(((r^2)*x)-(r*x)^2)*(1-r*x+r*(x^2)); //f2x=second-iterate map.
+ plot2d(x,f2x,style=-2)
+ y=x; //to plot y=x line.
+ plot2d(x,y,style=-4)
+end
+xtitle("Second Iterate Map","x-Axis ( x )","y-Axis ( f ^ 2 (x) )")
\ No newline at end of file diff --git a/27/CH10/EX10.3.3/Example_10_3_3.sce b/27/CH10/EX10.3.3/Example_10_3_3.sce new file mode 100755 index 000000000..82b3e0c36 --- /dev/null +++ b/27/CH10/EX10.3.3/Example_10_3_3.sce @@ -0,0 +1,28 @@ +//Example 10.3.2 Page 358
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+r=0:0.1:5;
+size1=length(r);
+x=zeros(601,size1);
+x(1,1:size1)=0.1;
+for r1=1:size1
+ for n=1:600
+ x(n+1,r1)=r(r1)*x(n,r1)*(1-x(n,r1));
+ end
+end
+
+//z=zeros(301,size1);
+for r1=1:size1
+ for n=300:600
+ //z(n-299,r1)=x(n+1,r1);
+ plot2d(r(r1),x(n+1),style=-2)
+ end
+end
+
+// End of Example
\ No newline at end of file diff --git a/27/CH10/EX10.6.1/10_6_1.jpg b/27/CH10/EX10.6.1/10_6_1.jpg Binary files differnew file mode 100755 index 000000000..eb715a248 --- /dev/null +++ b/27/CH10/EX10.6.1/10_6_1.jpg diff --git a/27/CH10/EX10.6.1/Example_10_6_1.sce b/27/CH10/EX10.6.1/Example_10_6_1.sce new file mode 100755 index 000000000..f31809362 --- /dev/null +++ b/27/CH10/EX10.6.1/Example_10_6_1.sce @@ -0,0 +1,15 @@ +//Example 10.6.1 Page 369
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//Sine Map
+r=0.5;
+for xn=0:0.01:1
+ xn_one=r*sin(%pi*xn);
+ plot2d(xn,xn_one,style=-3)
+end
diff --git a/27/CH10/EX10.7.2/Example_10_7_2.sce b/27/CH10/EX10.7.2/Example_10_7_2.sce new file mode 100755 index 000000000..e9a7688ec --- /dev/null +++ b/27/CH10/EX10.7.2/Example_10_7_2.sce @@ -0,0 +1,23 @@ +//Example 10.7.2 Page 386
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+
+x=poly(0,"x");
+f = (x^2)+4*x-2; //Defining Polynomial--> x(dot)=x^2 -1. Let this be f(x)
+disp("Fixed Points are :")
+y = roots(f);
+
+// -2+sqrt(6)=0.4494897
+
+// As seen earlier period 2 cycle occours at r=3.
+
+//Hence,
+
+r2=y(1)+3
+
+
+//End of Example.
\ No newline at end of file diff --git a/27/CH10/EX10.7.3/Example_10_7_3.sce b/27/CH10/EX10.7.3/Example_10_7_3.sce new file mode 100755 index 000000000..b7449ed3e --- /dev/null +++ b/27/CH10/EX10.7.3/Example_10_7_3.sce @@ -0,0 +1,21 @@ +//Example 10.7.2 Page 386
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+
+x=poly(0,"x");
+f = (x^2)+3*x-2; //Defining Polynomial--> x(dot)=x^2 -1. Let this be f(x)
+disp("Fixed Points are :")
+y = roots(f)
+
+// As seen earlier period 2 cycle occours at r=3.
+
+//Hence,
+
+r2=y(1)+3
+
+
+//End of Example.
\ No newline at end of file diff --git a/27/CH11/EX11.3.1/Example_11_3_1.sce b/27/CH11/EX11.3.1/Example_11_3_1.sce new file mode 100755 index 000000000..14bf18d11 --- /dev/null +++ b/27/CH11/EX11.3.1/Example_11_3_1.sce @@ -0,0 +1,16 @@ +//Example 11.3.1 Page 407
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+
+// m = number of copies.
+// r = scale factor.
+m=2;
+r=3;
+
+d=log(m)/log(r)
+
+//End of Example.
\ No newline at end of file diff --git a/27/CH11/EX11.3.2/Example_11_3_2.sce b/27/CH11/EX11.3.2/Example_11_3_2.sce new file mode 100755 index 000000000..250daf7a7 --- /dev/null +++ b/27/CH11/EX11.3.2/Example_11_3_2.sce @@ -0,0 +1,16 @@ +//Example 11.3.2 Page 407
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+
+// m = number of copies.
+// r = scale factor.
+m=4;
+r=3;
+
+d=log(m)/log(r)
+
+//End of Example.
\ No newline at end of file diff --git a/27/CH11/EX11.3.3/Example_11_3_3.sce b/27/CH11/EX11.3.3/Example_11_3_3.sce new file mode 100755 index 000000000..7056fe643 --- /dev/null +++ b/27/CH11/EX11.3.3/Example_11_3_3.sce @@ -0,0 +1,16 @@ +//Example 11.3.3 Page 408
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+
+// m = number of copies.
+// r = scale factor.
+m=3;
+r=5;
+
+d=log(m)/log(r)
+
+//End of Example.
\ No newline at end of file diff --git a/27/CH11/EX11.4.1/Example_11_4_1.sce b/27/CH11/EX11.4.1/Example_11_4_1.sce new file mode 100755 index 000000000..31433111f --- /dev/null +++ b/27/CH11/EX11.4.1/Example_11_4_1.sce @@ -0,0 +1,19 @@ +//Example 11.4.1 Page 409
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+
+// N(E) = minimum number of D-dimensional cubes of side E needed to cover S.
+
+n=poly(0,"n") //Defining polynomial in "n"
+Num = (n*log(2)) //Num. = Numerator
+Den = (n*log(3)) //Den. = Denominator
+disp("The box dimension is :")
+
+d=(Num)/(Den) //d = Box Dimension.
+
+
+//End of Example.
\ No newline at end of file diff --git a/27/CH11/EX11.4.2/Example_11_4_2.sce b/27/CH11/EX11.4.2/Example_11_4_2.sce new file mode 100755 index 000000000..36a734467 --- /dev/null +++ b/27/CH11/EX11.4.2/Example_11_4_2.sce @@ -0,0 +1,19 @@ +//Example 11.4.2 Page 410
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+clear;
+clear;
+clc;
+close;
+
+// N(E) = minimum number of D-dimensional cubes of side E needed to cover S.
+
+n=poly(0,"n") //Defining polynomial in "n"
+Num = (n*log(8)) //Num. = Numerator
+Den = (n*log(3)) //Den. = Denominator
+disp("The box dimension is :")
+
+d=(Num)/(Den) //d = Box Dimension.
+
+
+//End of Example.
\ No newline at end of file diff --git a/27/CH2/EX2.2.1/2_2_1.jpg b/27/CH2/EX2.2.1/2_2_1.jpg Binary files differnew file mode 100755 index 000000000..c60d30586 --- /dev/null +++ b/27/CH2/EX2.2.1/2_2_1.jpg diff --git a/27/CH2/EX2.2.1/Example_2_2_1.sce b/27/CH2/EX2.2.1/Example_2_2_1.sce new file mode 100755 index 000000000..ea7692212 --- /dev/null +++ b/27/CH2/EX2.2.1/Example_2_2_1.sce @@ -0,0 +1,30 @@ +//Example 2.2.1 Page 19
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","on") //hold off
+
+x=poly(0,"x");
+f = (x^2)-1; //Defining Polynomial--> x(dot)=x^2 -1. Let this be f(x)
+disp("Fixed Points are :")
+y = roots(f)
+
+set(gca(),"auto_clear","off") //hold on
+set(gca(),"grid",[2,5])
+for (x=-5:0.1:5)
+ plot2d(x,(x^2)-1,style=-2)
+
+end
+ plot2d(-1,0,style=-4) //To show "Diamond Sign" --> Representing a Fixed Stable Point.
+ plot2d(1,0,style=-3) //To Show "a Cross within Circle" --> Representing a Fixed Unstable Point.
+
+ xtitle("Stability Diagram","x-axis","x*-fix points")
+
+disp("From the diagram it is clear that x=-1 is the Fixed Stable Point.")
+disp("And x=+1 is the Unstable Fixed Point.")
+
+
+//End of Example 2.2.1
\ No newline at end of file diff --git a/27/CH2/EX2.2.2/2_2_2.jpg b/27/CH2/EX2.2.2/2_2_2.jpg Binary files differnew file mode 100755 index 000000000..73d4d4229 --- /dev/null +++ b/27/CH2/EX2.2.2/2_2_2.jpg diff --git a/27/CH2/EX2.2.2/2_2_2_2.jpg b/27/CH2/EX2.2.2/2_2_2_2.jpg Binary files differnew file mode 100755 index 000000000..746c0232c --- /dev/null +++ b/27/CH2/EX2.2.2/2_2_2_2.jpg diff --git a/27/CH2/EX2.2.2/Example_2_2_2.sce b/27/CH2/EX2.2.2/Example_2_2_2.sce new file mode 100755 index 000000000..954ad8446 --- /dev/null +++ b/27/CH2/EX2.2.2/Example_2_2_2.sce @@ -0,0 +1,46 @@ +//Example 2.2.2 Page 20
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","on") //hold off
+
+//As Resistance(R), Capacitance(C) and Voltage(V(0)) are constants so
+//Let R=4 , V(0)=10 , RC = 0.5 (Thus, C = 0.125)to plot Q(dot) v/s Q.
+// Thus, V(0)/R = 2.5
+//Q(dot) = f(Q) = 2.5 - Q/0.5 => Q(dot) = f(Q) = 2.5 - 2*Q.
+
+set(gca(),"auto_clear","off") //hold on
+for Q = -2:0.25:2
+ y = 2.5 - 2*Q ; //y=Q(dot)=f(Q)
+ plot2d(Q,y,style=-2)
+end
+plot2d(1.25,0,style=-4) //Just to depict Stable Fixed Point
+
+xtitle("Stability Diagram","Q","Q(dot)")
+set(gca(),"grid",[2,5]) //Grid on
+
+disp("From the Figure of Q(dot) v/s Q => we can find the Fixed Point (where Q(dot) crosses X-Axis)")
+
+disp("Put Q(dot)=0 => Q* = CV(0), Q* = CV(0) = 1.25 in our case.")
+disp("From the figure itself it is clear that the Fixed Point is Stable.")
+
+
+// Now Second Part of the question.
+//From our knowledge of Electronics and Twelth Class we know that :-
+//Charging of Capacitor is described as Exponentially increasing with time. (-exp(-t))
+figure //To get a new Graphic Window
+
+for t=0:0.2:3
+ Q = 1-exp(-t); //To show exponential increasing nature of graph starting from Q=0.
+ plot2d(t,Q,style=-2)
+end
+set(gca(),"grid",[2,5])
+xtitle("Charging of Capacitor","x-axis (Time)","Q(t)-charge")
+//End of Example 2.2.2
+
+
+
+
diff --git a/27/CH2/EX2.2.3/2_2_3.jpg b/27/CH2/EX2.2.3/2_2_3.jpg Binary files differnew file mode 100755 index 000000000..440bf1c80 --- /dev/null +++ b/27/CH2/EX2.2.3/2_2_3.jpg diff --git a/27/CH2/EX2.2.3/Example_2_2_3.sce b/27/CH2/EX2.2.3/Example_2_2_3.sce new file mode 100755 index 000000000..1c955855c --- /dev/null +++ b/27/CH2/EX2.2.3/Example_2_2_3.sce @@ -0,0 +1,25 @@ +//Example 2.2.3 Page 21
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+for x=-5:0.25:5
+ y1 = x;
+ y2 = cos(x);
+ plot2d(x,y1,style=-2)
+ plot2d(x,y2,style=-2)
+end
+//plot2d(0.75,0.75, style=-3) //To show that the fixed point is Unstable.
+set(gca(),"grid",[2,5])
+xtitle("Phase Potrait","x-axis","Y-axis, y=x, y=cos(x)")
+
+disp ("OBSERVATIONS from the Graph :-")
+disp("1. y=x and y=cos(x) intersects at exactly one point.")
+disp("2. The fixed point is Unstable ")
+
+
+//End of Example 2.2.3 Page 21.
\ No newline at end of file diff --git a/27/CH2/EX2.4.1/2_4_1.jpg b/27/CH2/EX2.4.1/2_4_1.jpg Binary files differnew file mode 100755 index 000000000..77283a77b --- /dev/null +++ b/27/CH2/EX2.4.1/2_4_1.jpg diff --git a/27/CH2/EX2.4.1/Example_2_4_1.sce b/27/CH2/EX2.4.1/Example_2_4_1.sce new file mode 100755 index 000000000..848f8bf1f --- /dev/null +++ b/27/CH2/EX2.4.1/Example_2_4_1.sce @@ -0,0 +1,26 @@ +//Example 2.4.1 Page 25
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+
+disp("When x(double dot) < 0 then => Fixed Point is Stable.")
+disp("When x(double dot) > 0 then => Fixed Point is Unstable.")
+
+//x(dot) = f(x) = sin(x) =0 => x* = k*pi
+
+for k= -5*(%pi):%pi:5*(%pi)
+ f1 = cos(k)
+ plot2d(k,f1,style=-4)
+end
+
+for x= -5*(%pi):0.2:5*(%pi)
+ f = sin(x);
+ plot2d(x,f,style=-2)
+end
+set(gca(),"grid",[2,5])
+xtitle("f(dot) (x*) and sin (x)","x-Axis","y-Axis (Sin(x))")
\ No newline at end of file diff --git a/27/CH2/EX2.4.2/2_4_2.jpg b/27/CH2/EX2.4.2/2_4_2.jpg Binary files differnew file mode 100755 index 000000000..8bcd58c31 --- /dev/null +++ b/27/CH2/EX2.4.2/2_4_2.jpg diff --git a/27/CH2/EX2.4.2/Example_2_4_2.sce b/27/CH2/EX2.4.2/Example_2_4_2.sce new file mode 100755 index 000000000..04ddab9d0 --- /dev/null +++ b/27/CH2/EX2.4.2/Example_2_4_2.sce @@ -0,0 +1,27 @@ +//Example 2.4.2 Page 25
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//f(N) = N(dot) = r*N(1-N/K)
+// Let r = 5 and K = 1600; to plot N(dot) v/s N
+
+for N = 0:8:1600
+ f = 5*N*(1-(N/1500));
+ plot2d(N,f,style=-2)
+end
+set(gca(),"grid",[2,5])
+xtitle("Logistic Map","x-Axis(N)","y-Axis (N(dot))")
+
+disp("From graph of N(dot) v/s N it is obvious that :-")
+disp("N = 0 and N=K (1500 in our case) are fixed points.")
+disp("And N=0 is Unstable Fixed Point and N=K is Stable Fixed Point.")
+
+disp("When N(double dot) < 0 then => Fixed Point is Stable.")
+disp("When N(double dot) > 0 then => Fixed Point is Unstable.")
+
+//End of Example 2.4.2
\ No newline at end of file diff --git a/27/CH2/EX2.4.3/2_4_3.jpg b/27/CH2/EX2.4.3/2_4_3.jpg Binary files differnew file mode 100755 index 000000000..7c6c34332 --- /dev/null +++ b/27/CH2/EX2.4.3/2_4_3.jpg diff --git a/27/CH2/EX2.4.3/Example_2_4_3.sce b/27/CH2/EX2.4.3/Example_2_4_3.sce new file mode 100755 index 000000000..e4bbb966e --- /dev/null +++ b/27/CH2/EX2.4.3/Example_2_4_3.sce @@ -0,0 +1,41 @@ +//Example 2.4.3 Page 25
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+
+for x = -5:0.5:5
+ f1 = -(x^3);
+ subplot(221)
+ plot2d(x,f1,style=-2)
+ plot2d(0,0,style=-4)
+ set(gca(),"grid",[2,5])
+ xtitle("Bifurcation-Diagram","x-Axis(x)","y-Axis (x(dot))")
+
+ f2 = x^3;
+ subplot(222)
+ plot2d(x,f2,style=-2)
+ plot2d(0,0,style=-3)
+ set(gca(),"grid",[2,5])
+ xtitle("Bifurcation-Diagram","x-Axis(x)","y-Axis (x(dot))")
+
+ f3 = x^2;
+ subplot(223)
+ plot2d(x,f3,style=-2)
+ plot2d(0,0,style=-5)
+ set(gca(),"grid",[2,5])
+ xtitle("Bifurcation-Diagram","x-Axis(x)","y-Axis (x(dot))")
+
+ f4 = 0;
+ subplot(224)
+ plot2d(x,f4,style=-2)
+ set(gca(),"grid",[2,5])
+ xtitle("Bifurcation-Diagram","x-Axis(x)","y-Axis (x(dot))")
+
+end
+//set(gca(),"grid",[2,5])
+//xtitle("Logistic Map","x-Axis(N)","y-Axis (N(dot))")
\ No newline at end of file diff --git a/27/CH2/EX2.7.1/2_7_1.jpg b/27/CH2/EX2.7.1/2_7_1.jpg Binary files differnew file mode 100755 index 000000000..f0ab23090 --- /dev/null +++ b/27/CH2/EX2.7.1/2_7_1.jpg diff --git a/27/CH2/EX2.7.1/Example_2_7_1.sce b/27/CH2/EX2.7.1/Example_2_7_1.sce new file mode 100755 index 000000000..216610a0c --- /dev/null +++ b/27/CH2/EX2.7.1/Example_2_7_1.sce @@ -0,0 +1,30 @@ +//Example 2.7.1 Page 31
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//x(dot) = f(x) = -x
+// On Integrating we get V(x) = (1/2)x^2 + C ; C = 0.
+
+//Now, Plotting the potential i.e. V(x)
+
+for x = -5:0.5:5
+ V = (1/2)*x^2;
+ plot2d(x,V,style=-2)
+end
+plot2d(0,0,style=-4) //Just to show that the fixed point is Stable.
+set(gca(),"grid",[2,5])
+xtitle("Potential Diagram","x-Axis(x)","y-Axis (V(x))")
+
+disp("From graph of V(x) v/s x itself, it is clear that :-")
+disp("The only equilibrium point is at x=0")
+disp(" And from the flow we can conclude that the x*=0 point is Stable.")
+
+disp("OR")
+disp("f(dot)(x) = -1 for all x; Thus every equilibrium point which exists is Stable.")
+
+//End of Example.
\ No newline at end of file diff --git a/27/CH2/EX2.7.2/2_7_2.jpg b/27/CH2/EX2.7.2/2_7_2.jpg Binary files differnew file mode 100755 index 000000000..7af0e9261 --- /dev/null +++ b/27/CH2/EX2.7.2/2_7_2.jpg diff --git a/27/CH2/EX2.7.2/Example_2_7_2.sce b/27/CH2/EX2.7.2/Example_2_7_2.sce new file mode 100755 index 000000000..16e1b7ee2 --- /dev/null +++ b/27/CH2/EX2.7.2/Example_2_7_2.sce @@ -0,0 +1,23 @@ +//Example 2.7.2 Page 31
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//Given : x(dot) = f(x) = x - x^3.
+//On integrating we get --> V(x) = -(1/2)x^2 + (1/4)x^4 + C ; C=0.
+
+//Now plotting V(x) v/s x ; and observe fix points and their Stabilities
+
+for x = -2:0.05:2
+ V = -(1/2)*(x^2) + (1/4)*(x^4);
+ plot2d(x,V,style=-2)
+end
+plot2d(0,0,style=-3) //Just to show that the fixed point is UnStable.
+plot2d(-1,-1/4,style=-4) //Just to show that the fixed point is Stable.
+plot2d(1,-1/4,style=-4) //Just to show that the fixed point is Stable.
+set(gca(),"grid",[2,5])
+xtitle("Double-Well Potential Diagram (Bistable)","x-Axis(x)","y-Axis (V(x))")
\ No newline at end of file diff --git a/27/CH3/EX3.1.1/3_1_1.jpg b/27/CH3/EX3.1.1/3_1_1.jpg Binary files differnew file mode 100755 index 000000000..12c53552a --- /dev/null +++ b/27/CH3/EX3.1.1/3_1_1.jpg diff --git a/27/CH3/EX3.1.1/Example_3_1_1.sce b/27/CH3/EX3.1.1/Example_3_1_1.sce new file mode 100755 index 000000000..a46e0fb3a --- /dev/null +++ b/27/CH3/EX3.1.1/Example_3_1_1.sce @@ -0,0 +1,62 @@ +// Example 3.1.1, Page = 47
+// Non-Linear Dynamics and Chaos, First Indian Edition
+//Steven H. Strogatz
+// x(dot)=f(x)=r-(x^2)
+// Notation: x1,x2,x3........ are the fixed point solutions
+// since x* is an error, because of multiplication operator.
+
+clear;
+clc;
+close;
+
+for r=-1:0.1:+1 //Varying value of parameter "r" so as to obtain bifurcation diagram.
+
+ x1 = +(sqrt(r)); //First Fixed Point.
+ x2 = -(sqrt(r)); //Second Fixed Point.
+ f1 = -2*x1; //f'(x) at x1.
+ f2 = -2*x2; //f'(x) at x2.
+
+ //x(double dot) = f'(x) = -2*x.
+ set(gca(),"auto_clear","off") //hold on
+ set(gca(),"grid",[2,5])
+ if (r<0) then
+ y = 0; //just to draw y=0 line for r<0, as no solution
+ disp(r)
+ disp("No fixed points.")
+ plot2d(r,y,style=-2)
+
+ else
+ set(gca(),"auto_clear","off")
+ if(f1>0) //unstable solutions
+ disp(r,x1)
+ disp("unstable solutions")
+ plot2d(r,x1,style=-1)
+
+ end
+ if(f1<0) //Stable solutions
+ disp(r,x1)
+ disp("stable solutions")
+ plot2d(r,x1,style=-2)
+
+ end
+
+ set(gca(),"auto_clear","off")
+
+ if(f2>0) //unstable solutions
+ disp(r,x2)
+ disp("unstable solutions")
+ plot2d(r,x2,style=-1)
+
+ end
+ if(f2<0) //stable solutions
+ disp(r,x2)
+ disp("stable solutions")
+ plot2d(r,x2,style=-2)
+
+ end
+ xtitle("Bifurcation Diagram","r-parameter","x*-fix points")
+ end
+end
+disp("Clearly from the graph x=0 is bifurcation point.")
+set(gca(),"auto_clear","on") //hold off
+//End of Example
diff --git a/27/CH3/EX3.1.2/3_1_2.jpg b/27/CH3/EX3.1.2/3_1_2.jpg Binary files differnew file mode 100755 index 000000000..c90f670a2 --- /dev/null +++ b/27/CH3/EX3.1.2/3_1_2.jpg diff --git a/27/CH3/EX3.1.2/Example_3_1_2.sce b/27/CH3/EX3.1.2/Example_3_1_2.sce new file mode 100755 index 000000000..7d5def513 --- /dev/null +++ b/27/CH3/EX3.1.2/Example_3_1_2.sce @@ -0,0 +1,32 @@ +// Example 3.1.2 Pg 47
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H.Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","on") //hold off
+
+for(r=0:1:3) //Varying value of parameter "r" to see number of fixed point solutions.
+ x=-2:0.1:3;
+ set(gca(),"grid",[2,5])
+ set(gca(),"auto_clear","off") //hold on
+ plot2d(x,exp(-x),style=-4)
+ plot2d(x,r-x,style=-2)
+ figure //to get new graphics window
+ set(gca(),"grid",[2,5])
+ xtitle("Graph showing Number of Fix Points","X-Axis","Y-Axis")
+end
+
+ disp("From the graph we get intersection point")
+ disp("And hence we got our FIXED POINT SOLUTION.")
+ disp("Clearly from graph we get stable solution when line is below exp(-x) graph.")
+ disp("Unstable solution when line is above exp(-x) graph.")
+ disp("From graph we infer that :")
+ disp("1. No Fixed Points for r<1")
+ disp("2. One Fixed Point when r=1.")
+ disp("3. Two Fixed Points for r>1.")
+ disp("hence Bifurcation Point is cleraly, r(c)=1")
+set(gca(),"auto_clear","on")
+//End of Example
+
\ No newline at end of file diff --git a/27/CH3/EX3.2.1/3_2_1.jpg b/27/CH3/EX3.2.1/3_2_1.jpg Binary files differnew file mode 100755 index 000000000..745e6dbc5 --- /dev/null +++ b/27/CH3/EX3.2.1/3_2_1.jpg diff --git a/27/CH3/EX3.2.1/Example_3_2_1.sce b/27/CH3/EX3.2.1/Example_3_2_1.sce new file mode 100755 index 000000000..496a07b75 --- /dev/null +++ b/27/CH3/EX3.2.1/Example_3_2_1.sce @@ -0,0 +1,52 @@ +//Example 3.2.1 Page 51
+//Non-Linear Dynamics and Chaos, First Indian Edition, Print-2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+
+// General INTRODUCTION
+disp("To show their is Transcritical Bifurcation show :")
+disp("1. Their are always two fixed points ,")
+disp("And they change their Stability around Bifurcation Point.")
+disp("2. Hence, the nature of given equation should be Quadratic.")
+disp("To show this use Taylor Expansion.")
+// END INTRODUCTION
+
+//By Taylor Expansion of given x(dot) and neglecting order(x^3) and higher order terms we get ----
+//x(dot) = (1-ab)x + (1/2)(ab*b)x^2.------Let x(dot) = f(x)
+
+//Stability Analysis : Put x(dot)=f(x)=0
+for(a=5) //Fixing one of the two parameters (i.e "a" And "b")
+ for(b=-4:0.15:3) //Varying another parameter to plot Bifurcation Diagram.
+
+ x1 = 0; //First Fixed Point
+ x2 = 2*(a*b -1)/(a*b*b); //Second Fixed Point
+ f1 = (1-a*b); //f'(x) at x1
+ f2 = -(1-a*b); //f'(x) at x2
+
+ //x(double dot)= f'(x) = (1-ab) + a(b^2)x
+
+ set(gca(),"auto_clear","off") //For "hold on" to plot points.
+ set(gca(),"grid",[2,5]) // To set axis
+ if(f1>0) //Unstable fixed point.
+ plot2d(1-a*b,x1,style=-2)
+ end
+ if(f1<0) //Stable Fixed point.
+ plot2d(1-a*b,x1,style=-3)
+ end
+ if(f2>0) //Unstable Fixed Point.
+ plot2d(1-a*b,x2,style=-2)
+ end
+ if(f2<0) //Stable Fixed Point.
+ plot2d(1-a*b,x2,style=-3)
+ end
+ xtitle("Bifurcation Diagram","x-axis (1-a*b)","x*-fix points")
+ end
+end
+disp("From Graph it is clearly visible that the two fixed points changes stability around point ab=1 ")
+
+set(gca(),"auto_clear","on") //for hold off
+
+//end of Example
\ No newline at end of file diff --git a/27/CH3/EX3.2.2/3_2_2.jpg b/27/CH3/EX3.2.2/3_2_2.jpg Binary files differnew file mode 100755 index 000000000..eaaf252f4 --- /dev/null +++ b/27/CH3/EX3.2.2/3_2_2.jpg diff --git a/27/CH3/EX3.2.2/Example_3_2_2.sce b/27/CH3/EX3.2.2/Example_3_2_2.sce new file mode 100755 index 000000000..2caacce8a --- /dev/null +++ b/27/CH3/EX3.2.2/Example_3_2_2.sce @@ -0,0 +1,47 @@ +//Example 3.2.2 Page 52
+//Non-Linear Dynamics and Chaos, First Indian Edition, Print-2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+
+//General INTRODUCTION
+disp("To show their is Transcritical Bifurcation show :")
+disp("1. Their are always two fixed points ,")
+disp("And they change their Stability around Bifurcation Point.")
+disp("2. Hence, the nature of given equation should be Quadratic.")
+disp("To show this use Taylor Expansion.")
+// End INTRODUCTION
+
+// u(dot) = (r+1)u - (1/2)r(u^2) + O(u^3)
+// u(dot) = (r+1)u - (1/2)r(u^2) + ZERO -----neglecting higher order terms
+// Let u(dot) = f(u)
+
+for r=-4:0.15:3 //Varying Parmater "r" to obtain Bifurcation Diagram
+ u1 = 0; //First Fixed Point.
+ u2 = 2*(r+1)/r; //Second Fixed Point.
+ f1 = (r+1); //f'(u) at u1
+ f2 = -(r+1); //f'(u) at u2
+ set(gca(),"auto_clear","off") //hold on
+ set(gca(),"grid",[2,5])
+
+ //u(double dot) = f'(u) = (r+1) - r*u
+
+ if (f1>0) then //Unstable Fixed Point.
+ plot2d(r+1,u1,style=-2)
+ end
+ if (f1<0) then //Stable Fixed Point.
+ plot2d(r+1,u1,style=-3)
+ end
+ if (f2>0) then //Unstable Fixed Point.
+ plot2d(r+1,u2,style=-2)
+ end
+ if (f2<0) then //Stable Fixed Point.
+ plot2d(r+1,u2,style=-3)
+ end
+ xtitle("Bifurcation Diagram","x-Axis -(r+1)","u*-fix points")
+end
+set(gca(),"auto_clear","on") //hold off
+disp("Clearly from the Bifurcation Diagram we see that r=-1 is the bifurcation point.")
+//end of Example
\ No newline at end of file diff --git a/27/CH3/EX3.4.1/3_4_1.jpg b/27/CH3/EX3.4.1/3_4_1.jpg Binary files differnew file mode 100755 index 000000000..4865ddfa1 --- /dev/null +++ b/27/CH3/EX3.4.1/3_4_1.jpg diff --git a/27/CH3/EX3.4.1/3_4_1_2.jpg b/27/CH3/EX3.4.1/3_4_1_2.jpg Binary files differnew file mode 100755 index 000000000..a2c8d7ae7 --- /dev/null +++ b/27/CH3/EX3.4.1/3_4_1_2.jpg diff --git a/27/CH3/EX3.4.1/Example_3_4_1.sce b/27/CH3/EX3.4.1/Example_3_4_1.sce new file mode 100755 index 000000000..c33a7b323 --- /dev/null +++ b/27/CH3/EX3.4.1/Example_3_4_1.sce @@ -0,0 +1,48 @@ +//Example 3.4.1 Page 57
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","on") //hold off
+
+for (B=0.5:0.5:2) //Capital "B" is denoting Beta.
+ x=-3:0.1:3;
+ y=x; //To plot x=y line.
+
+ figure;
+ set(gca(),"auto_clear","off") //hold on
+ set(gca(),"grid",[2,5])
+ plot2d(x,y,style=-4)
+ plot2d(x,B*tanh(x),style=-1)
+ xtitle("Intersection For different Beta values","x-Axis","y-Axis")
+
+
+end
+disp("From graph following points are clear:")
+disp("1. For B<1, only orign is the fixed point.")
+disp("2. For B>1, their are two new fixed points.")
+
+//Stability
+figure
+set(gca(),"grid",[2,5])
+for(x1 = -3:0.5:3)
+ if(x1~=0)
+ B = x1/tanh(x1);
+ plot2d(B,x1,style=-4)
+end
+
+for(B=0:0.1:3);
+ x1 = 0;
+if(B<1)
+ plot2d(B,x1,style=-4) //Stable
+else
+ plot2d(B,x1,style=-2) //Unstable
+end
+xtitle("Bifurcation Diagram","Beta Values-Parameter","x*-Fix Points")
+end
+end
+set(gca(),"auto_clear","on")
+//If B<1 then only one fixed point.
+//end of Example.
\ No newline at end of file diff --git a/27/CH3/EX3.4.2/3_4_2.jpg b/27/CH3/EX3.4.2/3_4_2.jpg Binary files differnew file mode 100755 index 000000000..2b45549e4 --- /dev/null +++ b/27/CH3/EX3.4.2/3_4_2.jpg diff --git a/27/CH3/EX3.4.2/Example_3_4_2.sce b/27/CH3/EX3.4.2/Example_3_4_2.sce new file mode 100755 index 000000000..380ede04f --- /dev/null +++ b/27/CH3/EX3.4.2/Example_3_4_2.sce @@ -0,0 +1,20 @@ +//Example 3.4.2 Page 58
+//Non-Linear Dynamics and Chaos First Indian Edition Print 2007
+//Steven H.Strogatz
+clear;
+clc;
+close;
+set(gca(),"auto_clear","on") //hold off
+
+for(r=-1:0.5:1)
+ x = -3:0.1:3;
+ V = -0.5*r*(x^2)+0.25*(x^4);
+ set(gca(),"auto_clear","off") //hold on
+ xtitle("Potential Diagram","X-Axis","Y-Axis")
+ plot2d(x,V,style=-4)
+ figure
+ set(gca(),"grid",[2,5])
+
+end
+set(gca(),"auto_clear","on")
+//End of Example
\ No newline at end of file diff --git a/27/CH4/EX4.1.1/4_1_1.jpg b/27/CH4/EX4.1.1/4_1_1.jpg Binary files differnew file mode 100755 index 000000000..e3069afb1 --- /dev/null +++ b/27/CH4/EX4.1.1/4_1_1.jpg diff --git a/27/CH4/EX4.1.1/4_1_1_2.jpg b/27/CH4/EX4.1.1/4_1_1_2.jpg Binary files differnew file mode 100755 index 000000000..7614b81c4 --- /dev/null +++ b/27/CH4/EX4.1.1/4_1_1_2.jpg diff --git a/27/CH4/EX4.1.1/Example_4_1_1.sce b/27/CH4/EX4.1.1/Example_4_1_1.sce new file mode 100755 index 000000000..7c6e05314 --- /dev/null +++ b/27/CH4/EX4.1.1/Example_4_1_1.sce @@ -0,0 +1,69 @@ +//Example 4.1.1 Page 94
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//Representing theta by O --> not zero it is alphabet "O"
+//Given :- O(dot) = f(O) = sinO.
+
+O1 = 0; //first Fix Point.
+O2 = %pi //Second Fix Point.
+
+//f(double dot) = O(double dot) = cosO.
+
+
+//////////////////// Computations Started /////////////////////////////
+
+f1 = cos(O1)
+f2 = cos(O2)
+
+if f1 > 0 then
+ disp("Zero is the Unstable Fixed Point.")
+else
+ disp("Zero is the Stable Fixed Point.")
+end
+
+if f2>0 then
+ disp("Pi is the Unstable Fixed Point.")
+else
+ disp("Pi is the Stable Fixed Point.")
+end
+
+/////////////////////////////////////////////////////////////////////
+
+figure(0)
+for O = 0:0.1:2*%pi
+ f = sin(O);
+ plot2d(O,f,style=-2)
+end
+
+//////////////// Figure(0) Properties //////////////////////
+a=get("current_axes");//get the handle of the newly created axes
+a.data_bounds=[-1,-2;7,2];
+set(gca(),"grid",[2,5])
+plot2d(0,0,style=-3) //Showing Unstable-Fixed Point with plus inside a circle
+plot2d(2*%pi,0,style=-4) //Showing Stable Fixed Point with diamond
+xtitle("Sine Wave on line","X - Axis","Y - Axis")
+//////////////////////////////////////////////////////////
+
+
+exec circle.sci //function to draw circle is executed
+figure(1) //Graphic Window(1)
+circle([0 0],4,50) //Circle is drawn with (0,0)as center, radius=4.
+
+///////////////// figure Properties /////////////////////////
+a=get("current_axes");//get the handle of the newly created axes
+a.data_bounds=[-5,-5;5,5];
+set(gca(),"grid",[2,5])
+plot2d(0,4,style=-13) //Showing Counter-Clockwise Direction
+plot2d(0,-4,style=-13) //Showing Counter-Clockwise Direction
+plot2d(4,0,style=-3) //Showing Unstable-Fixed Point with plus inside a circle
+plot2d(-4,0,style=-4) //Showing Stable Fixed Point with diamond
+xtitle("Vector Field on Circle","X - Axis","Y - Axis")
+/////////////////////////////////////////////////////////////
+
+//End of Example_4_1_1.
\ No newline at end of file diff --git a/27/CH4/EX4.1.2/Example_4_1_2.sce b/27/CH4/EX4.1.2/Example_4_1_2.sce new file mode 100755 index 000000000..b8bf04629 --- /dev/null +++ b/27/CH4/EX4.1.2/Example_4_1_2.sce @@ -0,0 +1,17 @@ +//Example 4.1.2 Page 94
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+
+disp("A Vector Field on the Circle is a Rule :-")
+disp("That assigns a unique velocity vector to each point on the circle.")
+
+disp("For this particular example Theta=0 and Theta=2*pi are same points...")
+disp("on the circle, but with different velocities.")
+disp("Thus it cannot be regarded as the vector field on the circle.")
+
+
+//End of Example_4.1.2
diff --git a/27/CH4/EX4.3.1/4_3_1.jpg b/27/CH4/EX4.3.1/4_3_1.jpg Binary files differnew file mode 100755 index 000000000..8226931b3 --- /dev/null +++ b/27/CH4/EX4.3.1/4_3_1.jpg diff --git a/27/CH4/EX4.3.1/4_3_1_2.jpg b/27/CH4/EX4.3.1/4_3_1_2.jpg Binary files differnew file mode 100755 index 000000000..71355b4ac --- /dev/null +++ b/27/CH4/EX4.3.1/4_3_1_2.jpg diff --git a/27/CH4/EX4.3.1/Example_4_3_1.sce b/27/CH4/EX4.3.1/Example_4_3_1.sce new file mode 100755 index 000000000..8ab7a73e9 --- /dev/null +++ b/27/CH4/EX4.3.1/Example_4_3_1.sce @@ -0,0 +1,50 @@ +//Example 4.3.1 Page 97
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+// Theta(dot) = f = w - a*sin(Theta)
+//a>w
+
+//Lets take w=2, a=5;
+
+for Theta=-%pi:0.1:%pi
+ f=2 - (5*sin(Theta)); //f = w-a*sin(Theta)
+ plot2d(Theta,f,style=-2)
+end
+
+///////////////// Figure Characteristics //////////////////////////
+ set(gca(),"grid",[2,5]) //Grid on
+
+for Theta=-2*%pi:0.4:2*%pi
+ plot2d(Theta,0,style=-1) //Just to plot X-Axis.
+ plot2d(0,Theta,style=-1) //Just to plot Y-Axis.
+end
+plot2d(0.41,0,style=-4) //Just to Show that the Fixed point is Stable.
+plot2d(2.75,0,style=-3) //Just to Show that the Fixed point is UnStable.
+plot2d(1.5,0,style=-13) //Just to Show the Flow.
+plot2d(-2,0,style=-12) //Just to Show the Flow.
+plot2d(3.2,0,style=-12) //Just to Show the Flow.
+ xtitle("Theta(dot) = w - a*sin(Theta), for a > w","X-Axis","Y-Axis")
+//////////////////////////////////////////////////////////////////
+
+exec circle.sci //function to draw circle is executed
+figure(1) //Graphic Window(1)
+circle([0 0],4,50) //Circle is drawn with (0,0)as center, radius=4.
+
+///////////////// figure Properties /////////////////////////
+a=get("current_axes");//get the handle of the newly created axes
+a.data_bounds=[-5,-5;5,5];
+set(gca(),"grid",[2,5])
+plot2d(0,4,style=-12) //Showing Vector Fields on Circle
+plot2d(4,0,style=-6) //Showing Vector Fields on Circle
+plot2d(-3,2.6,style=-3) //Showing Unstable-Fixed Point with plus inside a circle
+plot2d(3,2.6,style=-4) //Showing Stable Fixed Point with diamond
+xtitle("Vector Field on Circle for a > w","X - Axis","Y - Axis")
+/////////////////////////////////////////////////////////////
+
+//End of Example_4_3_1.
diff --git a/27/CH4/EX4.6.1/4_6_1.jpg b/27/CH4/EX4.6.1/4_6_1.jpg Binary files differnew file mode 100755 index 000000000..b717a45a1 --- /dev/null +++ b/27/CH4/EX4.6.1/4_6_1.jpg diff --git a/27/CH4/EX4.6.1/Example_4_6_1.sce b/27/CH4/EX4.6.1/Example_4_6_1.sce new file mode 100755 index 000000000..961bb2134 --- /dev/null +++ b/27/CH4/EX4.6.1/Example_4_6_1.sce @@ -0,0 +1,41 @@ +//Example 4.6.1 Page 110
+//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007
+//Steven H. Strogatz
+
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//After mathematical calculations they found:
+
+//<V> = 0 for I<=Ic
+//<V> = Ic*R*sqrt((I/Ic)^2 - 1) for I>Ic
+
+//Let V/RIc = Y
+//Let I/Ic = X
+
+//so, we have
+//Y = 0 for X<=1.
+//Y = sqrt((X^2)-1) for X>1.
+
+for X=0:0.05:3
+ if X<=1 then
+ Y=0;
+ plot2d(X,Y,style=-4)
+ else
+ Y=sqrt((X^2)-1);
+ plot2d(X,Y,style=-4)
+ end
+end
+
+for X=0:0.2:3
+ Y=X;
+ plot2d(X,Y,style=-2)
+end
+
+a=get("current_axes");//get the handle of the newly created axes
+a.data_bounds=[0,0;4,4];
+xtitle("I-V Curve","X - Axis ( I / Ic )","Y - Axis ( V / RIc )")
+
+//End of Example 4.6.1
\ No newline at end of file diff --git a/27/CH5/EX5.1.1/5_1_1.jpg b/27/CH5/EX5.1.1/5_1_1.jpg Binary files differnew file mode 100755 index 000000000..08a339d07 --- /dev/null +++ b/27/CH5/EX5.1.1/5_1_1.jpg diff --git a/27/CH5/EX5.1.1/5_1_1_2.jpg b/27/CH5/EX5.1.1/5_1_1_2.jpg Binary files differnew file mode 100755 index 000000000..5b26d1473 --- /dev/null +++ b/27/CH5/EX5.1.1/5_1_1_2.jpg diff --git a/27/CH5/EX5.1.1/Example_5_1_1.sce b/27/CH5/EX5.1.1/Example_5_1_1.sce new file mode 100755 index 000000000..fdd657401 --- /dev/null +++ b/27/CH5/EX5.1.1/Example_5_1_1.sce @@ -0,0 +1,55 @@ +clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+circle([0 0],4,50) //Circle is drawn with (0,0)as center, radius=4.
+circle([0,0],2,50)
+
+a=get("current_axes"); //get the handle of the newly created axes
+a.data_bounds=[-5,-5;5,5];
+
+for x = -4:2:4
+ for v = -4:2:4
+ if(x==0) & (v==0)
+ plot2d(x,v,style=-4) //if x=0 and v=0 then x(dot)and v(d ot) are also zero, thus Fixed point.
+ end
+ if(x==0) & (v>0)
+ plot2d(x,v,style=-12)
+ end
+ if(x==0) & (v<0)
+ plot2d(x,v,style=-13)
+ end
+ if(v==0) & (x>0)
+ plot2d(x,v,style=-7)
+ end
+ if(v==0) & (x<0)
+ plot2d(x,v,style=-6)
+ end
+ end
+end
+
+a=get("current_axes"); //get the handle of the newly created axes
+a.data_bounds=[-5,-5;5,5];
+xtitle("Vector Field","X - Axis ( X )","Y - Axis ( V )")
+ set(gca(),"grid",[2,5]) //Grid on
+
+figure
+function xd=linear511(t,x)
+ xd(1)=x(2); //x(dot); x(2) means v.
+ xd(2)=-50*x(1); //v(dot); x(1) means x.; Taking w^2=50;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xma x ymax], change them according to your needs.
+ nrect=15; //increase it to get more number of curves, i.e . more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:15
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear511);
+ plot2d(xout(1,:),xout(2,:));
+ end
diff --git a/27/CH5/EX5.1.2/5_1_2.jpg b/27/CH5/EX5.1.2/5_1_2.jpg Binary files differnew file mode 100755 index 000000000..c5000e036 --- /dev/null +++ b/27/CH5/EX5.1.2/5_1_2.jpg diff --git a/27/CH5/EX5.1.2/Example_5_1_2.sce b/27/CH5/EX5.1.2/Example_5_1_2.sce new file mode 100755 index 000000000..3d7248efc --- /dev/null +++ b/27/CH5/EX5.1.2/Example_5_1_2.sce @@ -0,0 +1,273 @@ +clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+a=-1; //Change a to get different figures; Not work for a=0 as z1 is not defined as slope is infinty
+i=1;j=1;
+for x=-10:1:10
+ if (x<>0) then //x<>0 because z1 not defined at x=0;
+ j=1;
+ for y=-5:2:5
+ x1 = a*x; //x1=x(dot)
+ y1 = -y; //y1=y(dot)
+ mat1(i,j)=x;
+ mat2(i,j)=y;
+ //plot2d(x1,y1,style=-4)
+ z1(i,j) = y1./x1; //tangent matrix; calculating slope at every point.
+ j=j+1;
+ end
+ i=i+1;
+ end
+end
+
+
+
+////////////////////// Phase Portrait computations Started ///////////////////////
+
+//Algorithm: (y-y0)=m*(x-x0) equation is used.
+//A straight line is drawn in every small interval surrounding x.
+i=1;
+ for yo=-5:2:5
+ for x=-10.5:0.2:-9.5
+ y=(z1(1,i)*(x+10))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+ // for x=-11:0.1:-9
+ // y=(0.25*(x+10))-3;
+ // plot2d(x,y,style=-3)
+ //end
+ // for x=-11:0.1:-9
+ //y=(0.25*(x+10))-1;
+ //plot2d(x,y,style=-1)
+ //end
+
+i=1;
+ for yo=-5:2:5
+ for x=-9.5:0.2:-8.5
+ y=(z1(2,i)*(x+9))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=-8.5:0.2:-7.5
+ y=(z1(3,i)*(x+8))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=-7.5:0.2:-6.5
+ y=(z1(4,i)*(x+7))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=-6.5:0.2:-5.5
+ y=(z1(5,i)*(x+6))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=-5.5:0.2:-4.5
+ y=(z1(6,i)*(x+5))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=-4.5:0.2:-3.5
+ y=(z1(7,i)*(x+4))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+
+i=1;
+ for yo=-5:2:5
+ for x=-3.5:0.2:-2.5
+ y=(z1(8,i)*(x+3))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+
+i=1;
+ for yo=-5:2:5
+ for x=-2.5:0.2:-1.5
+ y=(z1(9,i)*(x+2))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=-1.5:0.2:-0.5
+ y=(z1(10,i)*(x+1))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+
+i=1;
+ for yo=-5:2:5
+ for x=0.5:0.2:1.5
+ y=(z1(11,i)*(x-1))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=1.5:0.2:2.5
+ y=(z1(12,i)*(x-2))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+
+i=1;
+ for yo=-5:2:5
+ for x=2.5:0.2:3.5
+ y=(z1(13,i)*(x-3))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+
+i=1;
+ for yo=-5:2:5
+ for x=3.5:0.2:4.5
+ y=(z1(14,i)*(x-4))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=4.5:0.2:5.5
+ y=(z1(15,i)*(x-5))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+i=1;
+ for yo=-5:2:5
+ for x=5.5:0.2:6.5
+ y=(z1(16,i)*(x-6))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+
+i=1;
+ for yo=-5:2:5
+ for x=6.5:0.2:7.5
+ y=(z1(17,i)*(x-7))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=7.5:0.2:8.5
+ y=(z1(18,i)*(x-8))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=8.5:0.2:9.5
+ y=(z1(19,i)*(x-9))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+
+i=1;
+ for yo=-5:2:5
+ for x=9.5:0.2:10.5
+ y=(z1(20,i)*(x-10))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+//////////// Phase Portrait Computations Completed //////////////////
+
+
+//////////////// Drawing X-Axis
+for x=-11:9
+ y=0;
+ plot2d(x,y,style=-4)
+end
+
+/////////////// Drawing Y-Axis
+for y=-10:10
+ x=0;
+ plot2d(x,y,style=-4)
+
+end
+
+// flow lines on x-axis
+y=0;
+
+for x=-10:2:10
+ x1=a*x;
+ if(x1>0)
+ plot2d(x,y,style=-12);
+ elseif(x1<0)
+ plot2d(x,y,style=-13);
+ else
+ plot2d(x,y,style=-4);
+ end
+end
+
+
+// Flow lines on y-axis
+x=0;
+
+for y=-10:2:10
+ y1=-y;
+ if(y1>0)
+ plot2d(x,y,style=-6);
+ elseif(y1<0)
+ plot2d(x,y,style=-7);
+ else
+ plot2d(x,y,style=-4);
+ end
+end
+
+
+ xtitle("Phase Portrait for","x-Axis","y-Axis")
+
+
diff --git a/27/CH5/EX5.2.1/Example_5_2_1.sce b/27/CH5/EX5.2.1/Example_5_2_1.sce new file mode 100755 index 000000000..c0d8245f0 --- /dev/null +++ b/27/CH5/EX5.2.1/Example_5_2_1.sce @@ -0,0 +1,16 @@ +clear;
+clc;
+close;
+
+//Get the corresponding matrix equation.
+
+A = [1 1;4 -2]
+
+[R,E]=spec(A)
+
+//where E corresponds to eigen values
+//And R corresponds to eigen vectors.
+
+//Note that 0.9701425 = -4*0.2425356
+//And we can assume 0.7071068 to be 1.
+
diff --git a/27/CH5/EX5.2.2/5_2_2.jpg b/27/CH5/EX5.2.2/5_2_2.jpg Binary files differnew file mode 100755 index 000000000..017721c91 --- /dev/null +++ b/27/CH5/EX5.2.2/5_2_2.jpg diff --git a/27/CH5/EX5.2.2/Example_5_2_2.sce b/27/CH5/EX5.2.2/Example_5_2_2.sce new file mode 100755 index 000000000..24574dd95 --- /dev/null +++ b/27/CH5/EX5.2.2/Example_5_2_2.sce @@ -0,0 +1,20 @@ +clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+for x=-20:0.5:20
+ y1 = x;
+ y=0;
+ x1=0;
+ //h1=acosh(x);
+ plot2d(x,y1,style=-2)
+ plot2d(x,y,style=-4)
+ plot2d(x1,x,style=-4)
+
+end
+
+for x=-5:0.5:5
+ y2=-4*x;
+ plot2d(x,y2,style=-2)
+end
diff --git a/27/CH5/EX5.2.3/5_2_3.jpg b/27/CH5/EX5.2.3/5_2_3.jpg Binary files differnew file mode 100755 index 000000000..6fb6ecd30 --- /dev/null +++ b/27/CH5/EX5.2.3/5_2_3.jpg diff --git a/27/CH5/EX5.2.3/5_2_3_2.jpg b/27/CH5/EX5.2.3/5_2_3_2.jpg Binary files differnew file mode 100755 index 000000000..37c8cbc57 --- /dev/null +++ b/27/CH5/EX5.2.3/5_2_3_2.jpg diff --git a/27/CH5/EX5.2.3/Example_5_2_3.sce b/27/CH5/EX5.2.3/Example_5_2_3.sce new file mode 100755 index 000000000..2e65ec0e4 --- /dev/null +++ b/27/CH5/EX5.2.3/Example_5_2_3.sce @@ -0,0 +1,41 @@ +clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//Let lambda1<lambda2<0
+
+for x=-20:0.5:20
+ y1 = x;
+ y=0;
+ x1=0;
+ plot2d(x,y1,style=-2)
+ plot2d(x,y,style=-4)
+ plot2d(x1,x,style=-4)
+end
+
+for x=-5:0.5:5
+ y2=-4*x;
+ plot2d(x,y2,style=-2)
+end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
+figure
+function xd=linear523(t,x)
+ xd(1)=-x(1)-x(2); //x(dot); x(2) means y.
+ xd(2)=0*x(1)-2*x(2); //y(dot); x(1) means x.;
+ endfunction
+ bound=[-14,-25,14,25]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=10; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:10
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear523);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH5/EX5.2.4/5_2_4.jpg b/27/CH5/EX5.2.4/5_2_4.jpg Binary files differnew file mode 100755 index 000000000..0ec71a22c --- /dev/null +++ b/27/CH5/EX5.2.4/5_2_4.jpg diff --git a/27/CH5/EX5.2.4/5_2_4_2.jpg b/27/CH5/EX5.2.4/5_2_4_2.jpg Binary files differnew file mode 100755 index 000000000..75adac740 --- /dev/null +++ b/27/CH5/EX5.2.4/5_2_4_2.jpg diff --git a/27/CH5/EX5.2.4/Example_5_2_4.sce b/27/CH5/EX5.2.4/Example_5_2_4.sce new file mode 100755 index 000000000..e7a4d2d5d --- /dev/null +++ b/27/CH5/EX5.2.4/Example_5_2_4.sce @@ -0,0 +1,47 @@ +clear;
+clc;
+close;
+
+disp("When the eigen values are complex, then the fixed point is either :")
+disp("1. Center, or")
+disp("2. Spiral.")
+
+function xd=linear524(t,x)
+ xd(1)=0*x(1)+x(2); //x(dot); x(2) means y.
+ xd(2)=-4*x(1)+0*x(2); //y(dot); x(1) means x.;
+ endfunction
+ bound=[-14,-25,14,25]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=10; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:10
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear524);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
+ figure
+ function xd=linear5242(t,x)
+ xd(1)=-x(1)-x(2); //x(dot); x(2) means y.
+ xd(2)=4*x(1)-x(2); //y(dot); x(1) means x.;
+ endfunction
+ bound=[-14,-25,14,25]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=10; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:10
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear5242);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH5/EX5.2.6/Example_5_2_6.sce b/27/CH5/EX5.2.6/Example_5_2_6.sce new file mode 100755 index 000000000..39711acd1 --- /dev/null +++ b/27/CH5/EX5.2.6/Example_5_2_6.sce @@ -0,0 +1,9 @@ +clear;
+clc;
+close;
+
+A=[1 2;3 4]
+
+t=det(A)
+
+disp("Since t = -2 hence the fixed point is a Stable fixed point.")
diff --git a/27/CH5/EX5.2.7/Example_5_2_7.sce b/27/CH5/EX5.2.7/Example_5_2_7.sce new file mode 100755 index 000000000..d7d718050 --- /dev/null +++ b/27/CH5/EX5.2.7/Example_5_2_7.sce @@ -0,0 +1,11 @@ +clear;
+clc;
+close;
+
+A=[2 1;3 4]
+
+t=det(A)
+tau=trace(A)
+
+disp("Since t>0 and (tau)^2 - 4*t =16 >0 hence the fixed point is a node.")
+disp("It is unstable since tau>0.")
\ No newline at end of file diff --git a/27/CH6/EX6.1.1/6_1_1.jpg b/27/CH6/EX6.1.1/6_1_1.jpg Binary files differnew file mode 100755 index 000000000..123858e58 --- /dev/null +++ b/27/CH6/EX6.1.1/6_1_1.jpg diff --git a/27/CH6/EX6.1.1/Example_6_1_1.sce b/27/CH6/EX6.1.1/Example_6_1_1.sce new file mode 100755 index 000000000..9ae3c5bac --- /dev/null +++ b/27/CH6/EX6.1.1/Example_6_1_1.sce @@ -0,0 +1,107 @@ +clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+for y=-3:0.5:5
+ x = -exp(-y);
+ x1=0;
+ plot2d(x,y,style=-2)
+ plot2d(x1,y,style=-4)
+end
+
+
+for x=-30:0.5:5
+ y=0;
+ plot2d(x,y,style=-4)
+end
+
+/////////////// Flow ////////////////////////
+
+i=1;j=1;
+for x=-10:3:10
+ j=1;
+ for y=-5:2:5
+ x1 = x+exp(-y);
+ y1 = -y;
+ mat1(i,j)=x;
+ mat2(i,j)=y;
+ //plot2d(x1,y1,style=-4)
+ z1(i,j) = y1./x1;
+ j=j+1;
+ end
+ i=i+1;
+end
+
+
+i=1;
+ for yo=-5:2:5
+ for x=-11:0.5:-9.5
+ y=(z1(1,i)*(x+10))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+ // for x=-11:0.1:-9
+ // y=(0.25*(x+10))-3;
+ // plot2d(x,y,style=-3)
+ //end
+ // for x=-11:0.1:-9
+ //y=(0.25*(x+10))-1;
+ //plot2d(x,y,style=-1)
+ //end
+
+i=1;
+ for yo=-5:2:5
+ for x=-8:0.5:-6.5
+ y=(z1(2,i)*(x+7))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=-5:0.5:-3.5
+ y=(z1(3,i)*(x+4))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=-2:0.5:-0.5
+ y=(z1(4,i)*(x+1))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=1:0.5:2.5
+ y=(z1(5,i)*(x-2))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=4:0.5:5.5
+ y=(z1(6,i)*(x-5))+yo;
+ plot2d(x,y,style=-3)
+ end
+ i=i+1;
+ end
+
+i=1;
+ for yo=-5:2:5
+ for x=7:0.5:8.5
+ y=(z1(7,i)*(x-8))+yo;
+ plot2d(x,y,style=-4)
+ end
+ i=i+1;
+ end
\ No newline at end of file diff --git a/27/CH6/EX6.3.1/6_3_1.jpg b/27/CH6/EX6.3.1/6_3_1.jpg Binary files differnew file mode 100755 index 000000000..8345dbf1d --- /dev/null +++ b/27/CH6/EX6.3.1/6_3_1.jpg diff --git a/27/CH6/EX6.3.1/Example_6_3_1.sce b/27/CH6/EX6.3.1/Example_6_3_1.sce new file mode 100755 index 000000000..f77ff5c17 --- /dev/null +++ b/27/CH6/EX6.3.1/Example_6_3_1.sce @@ -0,0 +1,37 @@ +clear;
+clc;
+close;
+
+A1=[-1 0;0 -2] //Jacobian at (0,0)
+
+t1=det(A1)
+
+tau1=trace(A1)
+d1=((tau1)^2) - 4*t1
+
+A2=[2 0;0 -2] //Jacobian at (1,0) and (-1,0)
+t2=det(A2)
+
+disp("So from Chapter 5, we come to following conclusion :")
+disp("1. As t1>0 and tau1<.0 and d1>0 --> Thus (0,0) is Stable Node.")
+disp("2. As t2<0 --> Thus, only possibility is Saddle points.")
+
+function xd=linear611(t,x)
+ xd(1)=-(x(1))+x(1)^3; //x(dot); x(2) means y.
+ xd(2)=-2*x(2); //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=15; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:15
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear611);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH6/EX6.3.2/6_3_2.jpg b/27/CH6/EX6.3.2/6_3_2.jpg Binary files differnew file mode 100755 index 000000000..ddcc8fcda --- /dev/null +++ b/27/CH6/EX6.3.2/6_3_2.jpg diff --git a/27/CH6/EX6.3.2/6_3_2_2.jpg b/27/CH6/EX6.3.2/6_3_2_2.jpg Binary files differnew file mode 100755 index 000000000..40fb898bc --- /dev/null +++ b/27/CH6/EX6.3.2/6_3_2_2.jpg diff --git a/27/CH6/EX6.3.2/Example_6_3_2.sce b/27/CH6/EX6.3.2/Example_6_3_2.sce new file mode 100755 index 000000000..0596a36fb --- /dev/null +++ b/27/CH6/EX6.3.2/Example_6_3_2.sce @@ -0,0 +1,54 @@ +clear;
+clc;
+close;
+
+//On linearization we got the following Jacobian "A"
+
+A=[0 -1;1 0];
+t=det(A);
+tau=trace(A);
+
+disp("Since tau = 0 and t>0, thus from chapter 5, (0,0) is a Center")
+disp("And this does not depends on value of a ")
+
+a=-1;
+function xd=linear632(t,x)
+ xd(1)=-x(2)+ a*x(1)*(x(1)^2+x(2)^2); //x(dot); x(2) means y.
+ xd(2)=x(1)+a*x(2)*(x(1)^2+x(2)^2); //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=5; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:5
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear632);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
+ figure
+ a=1;
+function xd=linear6322(t,x)
+ xd(1)=-x(2)+ a*x(1)*(x(1)^2+x(2)^2); //x(dot); x(2) means y.
+ xd(2)=x(1)+a*x(2)*(x(1)^2+x(2)^2); //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=35; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:35
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear6322);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
diff --git a/27/CH6/EX6.5.2/6_5_2.jpg b/27/CH6/EX6.5.2/6_5_2.jpg Binary files differnew file mode 100755 index 000000000..952da8d3c --- /dev/null +++ b/27/CH6/EX6.5.2/6_5_2.jpg diff --git a/27/CH6/EX6.5.2/6_5_2_2.jpg b/27/CH6/EX6.5.2/6_5_2_2.jpg Binary files differnew file mode 100755 index 000000000..bbc9947ec --- /dev/null +++ b/27/CH6/EX6.5.2/6_5_2_2.jpg diff --git a/27/CH6/EX6.5.2/Example_6_5_2.sce b/27/CH6/EX6.5.2/Example_6_5_2.sce new file mode 100755 index 000000000..1a5ca34d2 --- /dev/null +++ b/27/CH6/EX6.5.2/Example_6_5_2.sce @@ -0,0 +1,65 @@ +clear;
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//Get x(dot) = y; y(dot)=x-(x^3);
+
+A1 = [0 1;1 0] //Jacobian at (0,0)
+t1=det(A1)
+
+A2 = [0 1;-2 0] //Jacobian at (1,0) and (-1,0).
+t2=det(A2)
+tau2=trace(A2)
+
+disp("Since, t1=-1, thus (0,0) is a SAddle Point.");
+disp("As t2=2 and tau2=0, thus (1,0) and (-1,0) are Centers.");
+
+
+[x y]=meshgrid(-5:0.5:5,-5:0.5:5);
+Nx=21;
+Ny=21;
+
+
+for i=1:21
+ for j=1:21
+ E(i,j) = ((1/2)*(y(i,j)^2)) -((1/2)*(x(i,j)^2)) + ((1/4)*(x(i,j)^4));
+ //contour(x,y,E,3);
+ end
+end
+
+l=-5:0.5:5;
+k=-5:0.5:5;
+plot3d(l,k,E);
+figure
+subplot(331)
+contour2d(l,k,E,2);
+
+subplot(335)
+for x=-2:0.1:2
+ V=((-1/2)*(x^2))+((1/4)*(x^4));
+ plot2d(x,V,style=-2)
+end
+subplot(339)
+function xd=linear652(t,x)
+ xd(1)=x(2);
+ xd(2)=x(1)-x(1)^3;
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=16; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:35
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear652);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH6/EX6.6.1/Example_6_6_1.sce b/27/CH6/EX6.6.1/Example_6_6_1.sce new file mode 100755 index 000000000..bea83f088 --- /dev/null +++ b/27/CH6/EX6.6.1/Example_6_6_1.sce @@ -0,0 +1,27 @@ +clear;
+clear;
+clc;
+close;
+//set(gca(),"auto_clear","off") //hold on
+
+//Obtain the Jacobian A:
+//A = [df/dx df/dy;dg/dx dg/dy]; where f=x(dot),g=y(dot)
+//df/dx=partial derivative of "f" w.r.t. "x"
+//Thus, A=[0 1-3(y^2); -1 -2*y];
+
+A1=[0 1;-1 0] //Jacobian at orign
+t1=det(A1)
+tau1=trace(A1)
+
+disp("Since t1>0 and tau1=0 thus orign is a linear center.")
+disp("Furthermore, the system is reversible, Thus by theorem 6.6.1-->")
+disp("We conclude that the orign is a nonlinear center.")
+
+A2=[0 -2;-1 -2] //Jacobian at (-1,1)
+t2=det(A2)
+
+A3=[0 -2;-1 2] //Jacobian at (-1,-1)
+t3=det(A3)
+
+disp("Since t2=t3=-2, Thus (-1,1) and (-1,-1) are Saddle Points.")
+
diff --git a/27/CH6/EX6.6.3/Example_6_6_3.sce b/27/CH6/EX6.6.3/Example_6_6_3.sce new file mode 100755 index 000000000..86ba7b6c6 --- /dev/null +++ b/27/CH6/EX6.6.3/Example_6_6_3.sce @@ -0,0 +1,34 @@ +clear;
+clear;
+clc;
+close;
+//obtain the General Jacobian "A";
+
+x1= %pi/2; y1= %pi/2;
+x2= %pi/2; y2= -%pi/2;
+x3= -%pi/2; y3= %pi/2;
+x4= -%pi/2; y4= -%pi/2;
+
+A1 = [2*sin(x1) sin(y1); sin(x1) 2*sin(y1)]
+t1=det(A1)
+tau1=trace(A1)
+d1 = ((tau1)^2) - 4*t1
+A2 = [2*sin(x2) sin(y2); sin(x2) 2*sin(y2)]
+t2=det(A2)
+tau2=trace(A2)
+d2 = ((tau2)^2) - 4*t2
+A3 = [2*sin(x3) sin(y3); sin(x3) 2*sin(y3)]
+t3=det(A3)
+tau3=trace(A3)
+d3 = ((tau3)^2) - 4*t3
+A4 = [2*sin(x4) sin(y4); sin(x4) 2*sin(y4)]
+t4=det(A4)
+tau4=trace(A4)
+d4 = ((tau4)^2) - 4*t4
+
+
+disp("From the above information we come to following conclusion:")
+disp("1. (pi/2,pi/2) --> Unstable Node.")
+disp("2. (pi/2,-pi/2) --> Saddle.")
+disp("3. (-pi/2,pi/2) --> Saddle.")
+disp("4. (-pi/2,-pi/2) --> Stable Node.")
\ No newline at end of file diff --git a/27/CH7/EX7.1.1/7_1_1.jpg b/27/CH7/EX7.1.1/7_1_1.jpg Binary files differnew file mode 100755 index 000000000..10954eb68 --- /dev/null +++ b/27/CH7/EX7.1.1/7_1_1.jpg diff --git a/27/CH7/EX7.1.1/7_1_1_2.jpg b/27/CH7/EX7.1.1/7_1_1_2.jpg Binary files differnew file mode 100755 index 000000000..335741cff --- /dev/null +++ b/27/CH7/EX7.1.1/7_1_1_2.jpg diff --git a/27/CH7/EX7.1.1/Example_7_1_1.sce b/27/CH7/EX7.1.1/Example_7_1_1.sce new file mode 100755 index 000000000..b897f3b9e --- /dev/null +++ b/27/CH7/EX7.1.1/Example_7_1_1.sce @@ -0,0 +1,44 @@ +clear;
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+// Note r=-1 is not the fixed point as radius can't be negative.
+
+r1=0; //First Fixed Point
+r2=1; //Second Fixed Point
+
+for r=0:0.05:1.1
+ f=r*(1-(r^2));
+ plot2d(r,f,style=-2)
+end
+
+set(gca(),"grid",[2,5]) //Grid on
+plot2d(0,0,style=-3)
+plot2d(1,0,style=-4)
+plot2d(0.5,0,style=-12)
+plot2d(1.1,0,style=-13)
+xtitle("r(dot) = r * (1 - r^2)","x-Axis (r)","y-Axis (r dot)")
+figure
+function xd=linear711(t,x)
+ xd(1)=(cos(t)*sqrt(x(1)^2+x(2)^2)*(1-x(1)^2-x(2)^2))-(sqrt(x(1)^2+x(2)^2)*sin(t));
+ xd(2)=(sin(t)*sqrt(x(1)^2+x(2)^2)*(1-x(1)^2-x(2)^2))+(sqrt(x(1)^2+x(2)^2)*cos(t));
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=16; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:16
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:6000;
+ xout=ode(x0,t0,t,linear711);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH7/EX7.1.2/7_1_2.jpg b/27/CH7/EX7.1.2/7_1_2.jpg Binary files differnew file mode 100755 index 000000000..02a2cd3f6 --- /dev/null +++ b/27/CH7/EX7.1.2/7_1_2.jpg diff --git a/27/CH7/EX7.1.2/Example_7_1_2.sce b/27/CH7/EX7.1.2/Example_7_1_2.sce new file mode 100755 index 000000000..e5b4b35e8 --- /dev/null +++ b/27/CH7/EX7.1.2/Example_7_1_2.sce @@ -0,0 +1,21 @@ +function xd=linear712(t,x)
+ xd(1)=x(2);
+ xd(2)=1.5*x(2)*(1-x(1)^2)-x(1);
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=6; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:6
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:6000;
+ xout=ode(x0,t0,t,linear712);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH7/EX7.2.3/7_2_3.jpg b/27/CH7/EX7.2.3/7_2_3.jpg Binary files differnew file mode 100755 index 000000000..d83c80cef --- /dev/null +++ b/27/CH7/EX7.2.3/7_2_3.jpg diff --git a/27/CH7/EX7.2.3/Example_7_2_3.sce b/27/CH7/EX7.2.3/Example_7_2_3.sce new file mode 100755 index 000000000..0f493dc96 --- /dev/null +++ b/27/CH7/EX7.2.3/Example_7_2_3.sce @@ -0,0 +1,21 @@ +function xd=linear723(t,x)
+ xd(1)=-x(1)+4*(x(2)); //x(dot); x(2) means y.
+ xd(2)=-x(1)-(x(2)^3); //y(dot); x(1) means x.;
+ endfunction
+ bound=[-8,-8,8,8]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=10; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:10
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:6000;
+ xout=ode(x0,t0,t,linear723);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
+disp("Change x and y bounds and also observe by changing nrect-->")
+ disp("We observe no close orbits for this system.")
\ No newline at end of file diff --git a/27/CH7/EX7.2.5/7_2_5.jpg b/27/CH7/EX7.2.5/7_2_5.jpg Binary files differnew file mode 100755 index 000000000..1f0cbd493 --- /dev/null +++ b/27/CH7/EX7.2.5/7_2_5.jpg diff --git a/27/CH7/EX7.2.5/Example_7_2_5.sce b/27/CH7/EX7.2.5/Example_7_2_5.sce new file mode 100755 index 000000000..bc001cc2e --- /dev/null +++ b/27/CH7/EX7.2.5/Example_7_2_5.sce @@ -0,0 +1,19 @@ +function xd=linear725(t,x)
+ xd(1)=(x(2)); //x(dot); x(2) means y.
+ xd(2)=-x(1)-x(2)+x(1)^2+x(2)^2; //y(dot); x(1) means x.;
+ endfunction
+ bound=[-15,-15,15,15]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=22; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:22
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:6000;
+ xout=ode(x0,t0,t,linear725);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH7/EX7.3.1/7_3_1.jpg b/27/CH7/EX7.3.1/7_3_1.jpg Binary files differnew file mode 100755 index 000000000..d7a68a1fe --- /dev/null +++ b/27/CH7/EX7.3.1/7_3_1.jpg diff --git a/27/CH7/EX7.3.1/Example_7_3_1.sce b/27/CH7/EX7.3.1/Example_7_3_1.sce new file mode 100755 index 000000000..7bb3ce14d --- /dev/null +++ b/27/CH7/EX7.3.1/Example_7_3_1.sce @@ -0,0 +1,21 @@ +function xd=linear731(t,x)
+ xd(1)=(cos(t)*sqrt(x(1)^2+x(2)^2)*(1-x(1)^2-x(2)^2))+(cos(t)*1*sqrt(x(1)^2+x(2)^2)*cos(t))-(sqrt(x(1)^2+x(2)^2)*sin(t));
+ xd(2)=(sin(t)*sqrt(x(1)^2+x(2)^2)*(1-x(1)^2-x(2)^2))+(sin(t)*1*sqrt(x(1)^2+x(2)^2)*cos(t))-(sqrt(x(1)^2+x(2)^2)*cos(t));
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=12; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:12
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear731);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH7/EX7.3.2/7_3_2.jpg b/27/CH7/EX7.3.2/7_3_2.jpg Binary files differnew file mode 100755 index 000000000..c48defc02 --- /dev/null +++ b/27/CH7/EX7.3.2/7_3_2.jpg diff --git a/27/CH7/EX7.3.2/Example_7_3_2.sce b/27/CH7/EX7.3.2/Example_7_3_2.sce new file mode 100755 index 000000000..e33eeea10 --- /dev/null +++ b/27/CH7/EX7.3.2/Example_7_3_2.sce @@ -0,0 +1,20 @@ +function xd=linear732(t,x)
+ xd(1)=-x(1)+2*x(2)+(x(1)^2)*x(2);
+ xd(2)=(4)-2*x(2)-(x(1)^2)*x(2);
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=22; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:22
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear732);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
+disp("From the figure we can clearly observe that the trajectories are giving it a limit cycle shape.")
\ No newline at end of file diff --git a/27/CH7/EX7.3.3/7_3_3.jpg b/27/CH7/EX7.3.3/7_3_3.jpg Binary files differnew file mode 100755 index 000000000..e77a0f5ec --- /dev/null +++ b/27/CH7/EX7.3.3/7_3_3.jpg diff --git a/27/CH7/EX7.3.3/7_3_3_2.jpg b/27/CH7/EX7.3.3/7_3_3_2.jpg Binary files differnew file mode 100755 index 000000000..b0d200f78 --- /dev/null +++ b/27/CH7/EX7.3.3/7_3_3_2.jpg diff --git a/27/CH7/EX7.3.3/Example_7_3_3.sce b/27/CH7/EX7.3.3/Example_7_3_3.sce new file mode 100755 index 000000000..c9f0636c4 --- /dev/null +++ b/27/CH7/EX7.3.3/Example_7_3_3.sce @@ -0,0 +1,50 @@ +clear;
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//Fixed Point is Stable for determinant(D) > 0 and trace(T) < 0.
+//To get limit cycle oscillations there should not be any fixed point
+//near to the limit cycle.
+
+//Thus, only possibilty left as D > 0, to have T > 0.
+
+//Curve between a and b :
+
+for a=0:0.01:0.14
+ b1=+sqrt(0.5*(1-2*a+sqrt(1-8*a)));
+ b2=+sqrt(0.5*(1-2*a-sqrt(1-8*a)));
+ b3=-sqrt(0.5*(1-2*a+sqrt(1-8*a)));
+ b4=-sqrt(0.5*(1-2*a-sqrt(1-8*a)));
+ plot2d(a,b1,style=-2)
+ plot2d(a,b2,style=-3)
+ plot2d(a,b2,style=-4)
+ plot2d(a,b2,style=-5)
+
+
+end
+xtitle("The Dividing Line Trace = 0","x-Axis ( a )","y-Axis ( b )")
+
+figure
+a=0.08;
+b=0.6;
+function xd=linear733(t,x)
+ xd(1)=-x(1)+a*x(2)+(x(1)^2)*x(2);
+ xd(2)=b-a*x(2)-((x(1)^2)*x(2));
+ endfunction
+ bound=[-1,-1,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=12; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:12
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear733);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH7/EX7.4.1/7_4_1.jpg b/27/CH7/EX7.4.1/7_4_1.jpg Binary files differnew file mode 100755 index 000000000..02a2cd3f6 --- /dev/null +++ b/27/CH7/EX7.4.1/7_4_1.jpg diff --git a/27/CH7/EX7.4.1/Example_7_4_1.sce b/27/CH7/EX7.4.1/Example_7_4_1.sce new file mode 100755 index 000000000..681a07264 --- /dev/null +++ b/27/CH7/EX7.4.1/Example_7_4_1.sce @@ -0,0 +1,21 @@ +function xd=linear741(t,x)
+ xd(1)=x(2);
+ xd(2)=1.5*x(2)*(1-x(1)^2)-x(1);
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=12; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:12
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear741);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH7/EX7.5.1/7_5_1.jpg b/27/CH7/EX7.5.1/7_5_1.jpg Binary files differnew file mode 100755 index 000000000..68327eca5 --- /dev/null +++ b/27/CH7/EX7.5.1/7_5_1.jpg diff --git a/27/CH7/EX7.5.1/Example_7_5_1.sce b/27/CH7/EX7.5.1/Example_7_5_1.sce new file mode 100755 index 000000000..894385322 --- /dev/null +++ b/27/CH7/EX7.5.1/Example_7_5_1.sce @@ -0,0 +1,23 @@ +mew=10;
+function xd=linear751(t,x)
+ F=(1/3)*(x(1)^3)-x(1);
+ xd(1)=mew*(x(2)-F);
+ xd(2)=-(1/mew)*x(1);
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=12; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:12
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear751);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH8/EX8.1.1/8_1_1.jpg b/27/CH8/EX8.1.1/8_1_1.jpg Binary files differnew file mode 100755 index 000000000..213639e71 --- /dev/null +++ b/27/CH8/EX8.1.1/8_1_1.jpg diff --git a/27/CH8/EX8.1.1/8_1_1_2.jpg b/27/CH8/EX8.1.1/8_1_1_2.jpg Binary files differnew file mode 100755 index 000000000..0d2d1db4c --- /dev/null +++ b/27/CH8/EX8.1.1/8_1_1_2.jpg diff --git a/27/CH8/EX8.1.1/Example_8_1_1.sce b/27/CH8/EX8.1.1/Example_8_1_1.sce new file mode 100755 index 000000000..bc2859744 --- /dev/null +++ b/27/CH8/EX8.1.1/Example_8_1_1.sce @@ -0,0 +1,53 @@ +clear;
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+a=0.4;
+b=0.8;
+for x=0:0.1:3
+ y1=a*x;
+ y2=(x^2)/(b*(1+x^2));
+ plot2d(x,y1,style=-2)
+ plot2d(x,y2,style=-3)
+end
+
+// Classification of fixed points :
+
+A1=[-a 1;0 -b] //Jacobian at (0,0)
+T=trace(A1) //Trace of A
+D=det(A1) //Determinant of A
+
+disp("Since, D>0, T<0 , orign is always a fixed point.")
+
+//Now using the arguments given in book and the figure obtained through this example, we conclude :
+
+disp("Middle Fixed Point lies between 0<x*<1, Thus is a Saddle Point.")
+disp("The Thied fixed point is with x*>1, Thus always a stable node.")
+
+xtitle("Nullclines--Showing Intersection of x(dot) and y(dot)","x-Axis ( x )","y-Axis ( y )")
+figure
+a=0.4;
+b=0.8;
+ function xd=linear811(t,x)
+ xd(1)=-a*x(1)+x(2);
+ xd(2)=((x(1)^2)/(1+x(1)^2))-b*x(2);
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[0,0,4,4]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=20; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:20
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear811);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH8/EX8.1.2/8_1_2.jpg b/27/CH8/EX8.1.2/8_1_2.jpg Binary files differnew file mode 100755 index 000000000..000a67da0 --- /dev/null +++ b/27/CH8/EX8.1.2/8_1_2.jpg diff --git a/27/CH8/EX8.1.2/8_1_2_2.jpg b/27/CH8/EX8.1.2/8_1_2_2.jpg Binary files differnew file mode 100755 index 000000000..80061fd92 --- /dev/null +++ b/27/CH8/EX8.1.2/8_1_2_2.jpg diff --git a/27/CH8/EX8.1.2/Example_8_1_2.sce b/27/CH8/EX8.1.2/Example_8_1_2.sce new file mode 100755 index 000000000..964073c1a --- /dev/null +++ b/27/CH8/EX8.1.2/Example_8_1_2.sce @@ -0,0 +1,73 @@ +clear;
+clear;
+clc;
+close;
+set(gca(),"auto_clear","off") //hold on
+
+//f = x(dot)
+//g = y(dot)
+//Obtain Jacobian as :
+//J=[df/dx df/dy; dg/dx dg/dy]
+//Thus, J=[mew-3*x^2 0; 0 -1]
+mew=2;
+subplot(221)
+for x=-2:0.1:2
+ y1=(mew*x)-x^3;
+ y2=0;
+ plot2d(x,y1,style=-2)
+ plot2d(x,y2,style=-3)
+end
+xtitle("Nullclines--Showing Intersection of x(dot) and y(dot) for mew > 0","x-Axis ( x )","y-Axis ( y )")
+//Stabilities for mew >0
+A1=[mew 0;0 -1] //Jacobian at (0,0)
+T1=trace(A1)
+D1=det(A1)
+A2=[-2*mew 0;0 -1] //Jacobian at (+sqrt(mew),0) and (-sqrt(mew),0)
+T2=trace(A2)
+D2=det(A2)
+Det = (T2^2) - 4*D2
+
+disp("Since D1<0, Thus (0,0) is a Saddle Point.")
+disp("Since T2<0, D2>0 and Det>0, thus (+sqrt(mew),0) and (-sqrt(mew),0) are stable points.")
+subplot(224)
+mew=-2;
+for x=-2:0.1:2
+ y1=(mew*x)-x^3;
+ y2=0;
+ plot2d(x,y1,style=-2)
+ plot2d(x,y2,style=-3)
+end
+xtitle("Nullclines--Showing Intersection of x(dot) and y(dot) for mew < 0","x-Axis ( x )","y-Axis ( y )")
+// Classification of fixed points :
+
+A3=[mew 0;0 -1] //Jacobian at (0,0)
+T3=trace(A3) //Trace of A
+D3=det(A3) //Determinant of A
+Det3=T3^2 - 4*D3
+disp("Since, D>0, T<0 , and Det3>0 orign is a stable fixed point.")
+
+
+//Note Stabilities can be deduced from the figures also as done in previous chapters.
+figure
+mew=-4;
+ function xd=linear812(t,x)
+ xd(1)=mew*x(1)-(x(1)^3);
+ xd(2)=-x(2);
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[-4,-4,4,14]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=10; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:10
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear812);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
diff --git a/27/CH8/EX8.1.3/8_1_3.jpg b/27/CH8/EX8.1.3/8_1_3.jpg Binary files differnew file mode 100755 index 000000000..6ef3e3594 --- /dev/null +++ b/27/CH8/EX8.1.3/8_1_3.jpg diff --git a/27/CH8/EX8.1.3/Example_8_1_3.sce b/27/CH8/EX8.1.3/Example_8_1_3.sce new file mode 100755 index 000000000..bf0bb81aa --- /dev/null +++ b/27/CH8/EX8.1.3/Example_8_1_3.sce @@ -0,0 +1,22 @@ +mew=-2.1;
+ function xd=linear813(t,x)
+ xd(1)=mew*x(1)+x(2)+sin(x(1));
+ xd(2)=x(1)-x(2);
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[-2,-2,2,2]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=20; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:20
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear813);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH8/EX8.2.1/8_2_1.jpg b/27/CH8/EX8.2.1/8_2_1.jpg Binary files differnew file mode 100755 index 000000000..17de7d5a2 --- /dev/null +++ b/27/CH8/EX8.2.1/8_2_1.jpg diff --git a/27/CH8/EX8.2.1/Example_8_2_1.sce b/27/CH8/EX8.2.1/Example_8_2_1.sce new file mode 100755 index 000000000..df7d9cc11 --- /dev/null +++ b/27/CH8/EX8.2.1/Example_8_2_1.sce @@ -0,0 +1,22 @@ +mew=-0.2;
+ function xd=linear821(t,x)
+ xd(1)=mew*x(1)-x(2)+x(1)*x(2)^2;
+ xd(2)=x(1)+mew*x(2)+x(2)^3;
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[-0.8,-0.8,0.8,0.8]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=35; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:35
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear821);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH8/EX8.3.1/8_3_1.jpg b/27/CH8/EX8.3.1/8_3_1.jpg Binary files differnew file mode 100755 index 000000000..a05c7b1c9 --- /dev/null +++ b/27/CH8/EX8.3.1/8_3_1.jpg diff --git a/27/CH8/EX8.3.1/Example_8_3_1.sce b/27/CH8/EX8.3.1/Example_8_3_1.sce new file mode 100755 index 000000000..a0926ad64 --- /dev/null +++ b/27/CH8/EX8.3.1/Example_8_3_1.sce @@ -0,0 +1,23 @@ +a=10;
+b=3;
+ function xd=linear831(t,x)
+ xd(1)=a-x(1)-((4*x(1)*x(2))/(1+x(1)^2));
+ xd(2)=(b*x(1))*(1-(x(2)/(1+x(1)^2)));
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[0,3,3,7]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=25; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:25
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear831);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/CH8/EX8.3.2/8_3_2.jpg b/27/CH8/EX8.3.2/8_3_2.jpg Binary files differnew file mode 100755 index 000000000..785a61e38 --- /dev/null +++ b/27/CH8/EX8.3.2/8_3_2.jpg diff --git a/27/CH8/EX8.3.2/8_3_2_2.jpg b/27/CH8/EX8.3.2/8_3_2_2.jpg Binary files differnew file mode 100755 index 000000000..c8347f243 --- /dev/null +++ b/27/CH8/EX8.3.2/8_3_2_2.jpg diff --git a/27/CH8/EX8.3.2/Example_8_3_2.sce b/27/CH8/EX8.3.2/Example_8_3_2.sce new file mode 100755 index 000000000..0662cb864 --- /dev/null +++ b/27/CH8/EX8.3.2/Example_8_3_2.sce @@ -0,0 +1,47 @@ +a=10;
+b=4;
+ function xd=linear832(t,x)
+ xd(1)=a-x(1)-((4*x(1)*x(2))/(1+x(1)^2));
+ xd(2)=(b*x(1))*(1-(x(2)/(1+x(1)^2)));
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[0,0,4,10]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=10; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:10
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear832);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
+ figure
+ a=10;
+b=2;
+ function xd=linear8322(t,x)
+ xd(1)=a-x(1)-((4*x(1)*x(2))/(1+x(1)^2));
+ xd(2)=(b*x(1))*(1-(x(2)/(1+x(1)^2)));
+ //x(dot); x(2) means y.
+ //y(dot); x(1) means x.;
+ endfunction
+ bound=[0,0,5,8]; //Bounds of x-axis and y-axis as [xmin ymin xmax ymax], change them according to your needs.
+ nrect=10; //increase it to get more number of curves, i.e. more information will be available.
+ set(gca(),"auto_clear","off") //hold on
+ x=linspace(bound(1),bound(3),nrect);
+ y=linspace(bound(2),bound(4),nrect);
+ x0=[];
+
+ for i=1:10
+ x0=[x(i);y(i)];
+ t0=0;
+ t=0:0.01:3000;
+ xout=ode(x0,t0,t,linear8322);
+ plot2d(xout(1,:),xout(2,:));
+ end
+ xtitle('Phase Portrait','x-axis ( x )','y-axis ( y )')
\ No newline at end of file diff --git a/27/DEPENDENCIES/circle.sci b/27/DEPENDENCIES/circle.sci new file mode 100755 index 000000000..7648e8fb0 --- /dev/null +++ b/27/DEPENDENCIES/circle.sci @@ -0,0 +1,15 @@ +function [] = circle(centre,radius,NOP)
+
+ THETA=linspace(0,2*%pi,NOP);
+ RHO=ones(1,NOP)*radius;
+ z=tan(THETA);
+ x=sqrt(((RHO).^2)./(1+(z.^2)));
+ y=x.*z;
+ x=x+centre(1);
+ y=y+centre(2);
+ plot2d(x,y,style=-2);
+ set(gca(),"auto_clear","off") //hold on
+ plot2d(-(x)+2*(centre(1)),y,style=-2);
+
+
+/////////////// End of Function circle
\ No newline at end of file |