summaryrefslogtreecommitdiff
path: root/830/CH4/EX4.4.2
diff options
context:
space:
mode:
Diffstat (limited to '830/CH4/EX4.4.2')
-rwxr-xr-x830/CH4/EX4.4.2/DTFT_3.sce29
1 files changed, 29 insertions, 0 deletions
diff --git a/830/CH4/EX4.4.2/DTFT_3.sce b/830/CH4/EX4.4.2/DTFT_3.sce
new file mode 100755
index 000000000..e398cf257
--- /dev/null
+++ b/830/CH4/EX4.4.2/DTFT_3.sce
@@ -0,0 +1,29 @@
+//Graphical//
+//Example 4.4.2
+//Frequency Response of Three point Moving Average System
+//y(n)= (1/3)[x(n+1)+x(n)+x(n-1)]
+//h(n) = [1/3,1/3,1/3]
+clear;
+clc;
+close;
+//Calculation of Impulse Response
+n =-1:1;
+h = [1/3,1/3,1/3];
+//Discrete-time Fourier transform
+K = 500;
+k = 0:1:K;
+w = %pi*k/K;
+H = h * exp(-sqrt(-1)*n'*w);
+//phasemag used to calculate phase and magnitude in dB
+[Phase_H,m] = phasemag(H);
+H = abs(H);
+subplot(2,1,1)
+plot2d(w/%pi,H)
+xlabel('Frequency in Radians')
+ylabel('abs(H)')
+title('Magnitude Response')
+subplot(2,1,2)
+plot2d(w/%pi,Phase_H)
+xlabel('Frequency in Radians')
+ylabel('<(H)')
+title('Phase Response')