diff options
author | priyanka | 2015-06-24 15:03:17 +0530 |
---|---|---|
committer | priyanka | 2015-06-24 15:03:17 +0530 |
commit | b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch) | |
tree | ab291cffc65280e58ac82470ba63fbcca7805165 /2048/CH5 | |
download | Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2 Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip |
initial commit / add all books
Diffstat (limited to '2048/CH5')
-rwxr-xr-x | 2048/CH5/EX5.1/incr_freq.sce | 15 | ||||
-rwxr-xr-x | 2048/CH5/EX5.2/filter1.sce | 20 | ||||
-rwxr-xr-x | 2048/CH5/EX5.3/ma_bode.sce | 14 | ||||
-rwxr-xr-x | 2048/CH5/EX5.4/derv_bode.sce | 15 | ||||
-rwxr-xr-x | 2048/CH5/EX5.5/nmp.sce | 18 |
5 files changed, 82 insertions, 0 deletions
diff --git a/2048/CH5/EX5.1/incr_freq.sce b/2048/CH5/EX5.1/incr_freq.sce new file mode 100755 index 000000000..349ad92c1 --- /dev/null +++ b/2048/CH5/EX5.1/incr_freq.sce @@ -0,0 +1,15 @@ +// Sinusoidal plots for increasing frequency
+// 5.1
+
+exec('stem.sci',-1);
+
+n=0:16;
+subplot(2,2,1), stem(n,cos(n*%pi/8))
+xgrid,xtitle('','n','cos(n*pi/8)')
+subplot(2,2,2), stem(n,cos(n*%pi/4))
+xgrid,xtitle('','n','cos(n*pi/4)')
+subplot(2,2,3), stem(n,cos(n*%pi/2))
+xgrid,xtitle('','n','cos(n*pi/2)')
+subplot(2,2,4), stem(n,cos(n*%pi))
+xgrid,xtitle('','n','cos(n*pi)')
+
diff --git a/2048/CH5/EX5.2/filter1.sce b/2048/CH5/EX5.2/filter1.sce new file mode 100755 index 000000000..fb7eb044e --- /dev/null +++ b/2048/CH5/EX5.2/filter1.sce @@ -0,0 +1,20 @@ +// Bode plots for Example 5.7 on page 141
+// 5.2
+
+exec('label.sci',-1);
+
+omega = linspace(0,%pi);
+g1 = 0.5 ./ (cos(omega)-0.5+%i*sin(omega));
+mag1 = abs(g1);
+angle1 = phasemag(g1);
+g2 = (0.5+0.5*cos(omega)-1.5*%i*sin(omega)) ...
+ * 0.25 ./ (1.25-cos(omega));
+mag2 = abs(g2);
+angle2 = phasemag(g2);
+subplot(2,1,1)
+plot(omega,mag1,omega,mag2,'--');
+label('',4,' ','Magnitude',4);
+subplot(2,1,2);
+plot(omega,angle1,omega,angle2,'--');
+label('',4,'w (rad/s)','Phase',4);
+
diff --git a/2048/CH5/EX5.3/ma_bode.sce b/2048/CH5/EX5.3/ma_bode.sce new file mode 100755 index 000000000..60929da6f --- /dev/null +++ b/2048/CH5/EX5.3/ma_bode.sce @@ -0,0 +1,14 @@ +// Bode plot of the moving average filter, discussed in Example 5.5 on page 129
+// 5.3
+
+exec('label.sci',-1);
+
+w = 0.01:0.01:%pi;
+subplot(2,1,1);
+mag = abs(1+2*cos(w))/3;
+plot2d("ll",w,mag,2);
+label('',4,' ','Magnitude',4);
+subplot(2,1,2);
+plot2d("ln",w,phasemag(1+2*cos(w)),style = 2,rect =[0.01 -0.5 10 200]);
+label('',4,'w','Phase',4)
+
diff --git a/2048/CH5/EX5.4/derv_bode.sce b/2048/CH5/EX5.4/derv_bode.sce new file mode 100755 index 000000000..e45509fff --- /dev/null +++ b/2048/CH5/EX5.4/derv_bode.sce @@ -0,0 +1,15 @@ +// Bode plot of the differencing filter, discussed in Example 5.6 on page 130
+// 5.4
+
+exec('label.sci',-1);
+
+w = 0.01:0.01:%pi;
+G = 1-exp(-%i*w);
+subplot(2,1,1)
+plot2d1("gll",w,abs(G),style = 2);
+label('',4,' ','Magnitude',4);
+subplot(2,1,2)
+plot2d1("gln",w,phasemag(G),style = 2);
+label('',4,'w','Phase',4)
+
+
diff --git a/2048/CH5/EX5.5/nmp.sce b/2048/CH5/EX5.5/nmp.sce new file mode 100755 index 000000000..99faf6b7f --- /dev/null +++ b/2048/CH5/EX5.5/nmp.sce @@ -0,0 +1,18 @@ +// Bode plot of minimum and nonminimum phase filters, discussed in Example 5.9 on page 145
+// 5.5
+
+exec('label.sci',-1);
+
+omega = linspace(0,%pi);
+ejw = exp(-%i*omega);
+G1 = 1.5*(1-0.4*ejw);
+mag1 = abs(G1); angle1 = phasemag(G1);
+G2 = -0.6*(1-2.5*ejw);
+mag2 = abs(G2); angle2 = phasemag(G2);
+subplot(2,1,1);
+plot(omega,mag1,omega,mag2,'--');
+label('',4,' ','Magnitude',4);
+subplot(2,1,2);
+plot(omega,angle1,omega,angle2,'--');
+label('',4,'w (rad/s)','Phase',4);
+
|