diff options
author | prashantsinalkar | 2017-10-10 12:38:01 +0530 |
---|---|---|
committer | prashantsinalkar | 2017-10-10 12:38:01 +0530 |
commit | f35ea80659b6a49d1bb2ce1d7d002583f3f40947 (patch) | |
tree | eb72842d800ac1233e9d890e020eac5fd41b0b1b /27/CH5/EX5.1.1 | |
parent | 7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (diff) | |
download | Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.gz Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.tar.bz2 Scilab-TBC-Uploads-f35ea80659b6a49d1bb2ce1d7d002583f3f40947.zip |
updated the code
Diffstat (limited to '27/CH5/EX5.1.1')
-rwxr-xr-x | 27/CH5/EX5.1.1/Example_5_1_1.sce | 110 |
1 files changed, 55 insertions, 55 deletions
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 |