diff options
Diffstat (limited to '27')
-rwxr-xr-x | 27/CH3/EX3.1.2/Example_3_1_2.sce | 63 | ||||
-rwxr-xr-x | 27/CH4/EX4.3.1/Example_4_3_1.sce | 100 | ||||
-rwxr-xr-x | 27/CH5/EX5.1.1/Example_5_1_1.sce | 110 |
3 files changed, 136 insertions, 137 deletions
diff --git a/27/CH3/EX3.1.2/Example_3_1_2.sce b/27/CH3/EX3.1.2/Example_3_1_2.sce index 7d5def513..57c0bb492 100755 --- a/27/CH3/EX3.1.2/Example_3_1_2.sce +++ b/27/CH3/EX3.1.2/Example_3_1_2.sce @@ -1,32 +1,31 @@ -// 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 +// Example 3.1.2 Pg 47 +//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007 +//Steven H.Strogatz + +clear; +clc; +close; +mtlb_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]); + mtlb_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") +mtlb_hold off +//End of Example
\ No newline at end of file diff --git a/27/CH4/EX4.3.1/Example_4_3_1.sce b/27/CH4/EX4.3.1/Example_4_3_1.sce index 8ab7a73e9..c238462a8 100755 --- a/27/CH4/EX4.3.1/Example_4_3_1.sce +++ b/27/CH4/EX4.3.1/Example_4_3_1.sce @@ -1,50 +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.
+//Example 4.3.1 Page 97 +//Non-Linear Dynamics and Chaos, First Indian Edition Print 2007 +//Steven H. Strogatz + +clear; +clc; +close; +mtlb_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.
\ No newline at end of file diff --git a/27/CH5/EX5.1.1/Example_5_1_1.sce b/27/CH5/EX5.1.1/Example_5_1_1.sce index fdd657401..9e90eccc5 100755 --- a/27/CH5/EX5.1.1/Example_5_1_1.sce +++ b/27/CH5/EX5.1.1/Example_5_1_1.sce @@ -1,55 +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
+clear; +clc; +close; +mtlb_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
\ No newline at end of file |