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 /215/CH18 | |
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 '215/CH18')
-rwxr-xr-x | 215/CH18/EX18.1/ex18_1.sce | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/215/CH18/EX18.1/ex18_1.sce b/215/CH18/EX18.1/ex18_1.sce index eed597b21..67b8d2638 100755 --- a/215/CH18/EX18.1/ex18_1.sce +++ b/215/CH18/EX18.1/ex18_1.sce @@ -1,44 +1,45 @@ -clear
-close
-clc
-//Example 18.1
-//From the figure 18.2
-disp('The equation of v(t) considering one period can be written as')
-disp('v(t)=Vm*cos(5*%pi*t) for -0.1<=t<=0.1')
-disp('v(t)=0 for 0.1<=t<=0.3')
-//Assuming the value of Vm is 1
-Vm=1;
-//Evaluating the constants an and bn
-//bn=0 for all n
-//an=(2*Vm*cos(n*%pi/2))/(%pi*(1-n^2))
-//a0=Vm/%pi
-t=-1:0.02:1
-v0t=Vm/%pi
-v1t=(1/2)*(Vm*cos(5*%pi*t))
-v0t_v1t=v0t+v1t
-v2t=(2/(3*%pi))*(Vm*cos(10*%pi*t))
-v0t_v1t_v2t=v0t+v1t+v2t
-v3t=(2/(15*%pi))*(Vm*cos(20*%pi*t))
-v0t_v1t_v2t_v3t=v0t+v1t+v2t-v3t
-figure
-a = gca ();
-a. y_location = "origin";
-a. x_location = "origin";
-a. data_bounds =[ -1,0;1 0.5];
-plot (t,v0t)
-xtitle('vot vs t','t in s','vot')
-figure
-a = gca ();
-a. y_location = "origin";
-a. x_location = "origin";
-a. data_bounds =[ -1,-0.5;1 0.5];
-plot (t,v0t_v1t)
-a. y_location = "origin";
-a. x_location = "origin";
-a. data_bounds =[ -1,-0.5;1 0.5];
-plot (t,v0t_v1t_v2t,'r.->')
-a. y_location = "origin";
-a. x_location = "origin";
-a. data_bounds =[ -1,-0.5;1 0.5];
-plot (t,v0t_v1t_v2t_v3t,'d')
-xtitle('v(t)','t in s','v(t) in V')
+clear +close +clc +//Example 18.1 +//From the figure 18.2 +disp('The equation of v(t) considering one period can be written as') +disp('v(t)=Vm*cos(5*%pi*t) for -0.1<=t<=0.1') +disp('v(t)=0 for 0.1<=t<=0.3') +//Assuming the value of Vm is 1 + +//Evaluating the constants an and bn +//bn=0 for all n +//an=(2*Vm*cos(n*%pi/2))/(%pi*(1-n^2)) +//a0=Vm/%pi +t=-1:0.02:1; +Vm=ones(1,length(t)); +v0t=Vm/%pi; +v1t=(Vm.*cos(5*%pi*t)).*0.5; +v0t_v1t=v0t+v1t; +v2t=(2/(3*%pi))*(Vm.*cos(10*%pi*t)); +v0t_v1t_v2t=v0t+v1t+v2t; +v3t=(2/(15*%pi))*(Vm.*cos(20*%pi*t)); +v0t_v1t_v2t_v3t=v0t+v1t+v2t-v3t; +figure +a = gca (); +a. y_location = "origin"; +a. x_location = "origin"; +a. data_bounds =[ -1,0;1 0.5]; +plot (t,v0t) +xtitle('vot vs t','t in s','vot') +figure +a = gca (); +a. y_location = "origin"; +a. x_location = "origin"; +a. data_bounds =[ -1,-0.5;1 0.5]; +plot (t,v0t_v1t) +a. y_location = "origin"; +a. x_location = "origin"; +a. data_bounds =[ -1,-0.5;1 0.5]; +plot (t,v0t_v1t_v2t,'r.->') +a. y_location = "origin"; +a. x_location = "origin"; +a. data_bounds =[ -1,-0.5;1 0.5]; +plot (t,v0t_v1t_v2t_v3t,'d') +xtitle('v(t)','t in s','v(t) in V')
\ No newline at end of file |