diff options
Diffstat (limited to '692/CH3')
-rwxr-xr-x | 692/CH3/EX3.10/P3_10.sce | 10 | ||||
-rwxr-xr-x | 692/CH3/EX3.12/P3_12.sce | 42 | ||||
-rwxr-xr-x | 692/CH3/EX3.13/P3_13.sce | 33 | ||||
-rwxr-xr-x | 692/CH3/EX3.14/P3_14.sce | 25 | ||||
-rwxr-xr-x | 692/CH3/EX3.15/P3_15.sce | 13 | ||||
-rwxr-xr-x | 692/CH3/EX3.5/P3_5.sce | 27 | ||||
-rwxr-xr-x | 692/CH3/EX3.6/P3_6.sce | 48 | ||||
-rwxr-xr-x | 692/CH3/EX3.7/P3_12.sce | 42 |
8 files changed, 240 insertions, 0 deletions
diff --git a/692/CH3/EX3.10/P3_10.sce b/692/CH3/EX3.10/P3_10.sce new file mode 100755 index 000000000..5bcfc04ab --- /dev/null +++ b/692/CH3/EX3.10/P3_10.sce @@ -0,0 +1,10 @@ +//EXAMPLE 3.10 +// DTFT of a sequence +clc; +clear; +syms a n M w; +x=a^n; +X=nusum(x*(exp(-%i*w*n)),n,0,M-1) +disp(limit(X),'The DTFT of the given sequence, X = ') + + diff --git a/692/CH3/EX3.12/P3_12.sce b/692/CH3/EX3.12/P3_12.sce new file mode 100755 index 000000000..35c37dc00 --- /dev/null +++ b/692/CH3/EX3.12/P3_12.sce @@ -0,0 +1,42 @@ +//EXAMPLE 3.12 +//x[n]=((-1)^n)*(a^n)*u[n].....given a=0.5; + +clc; +clear; + +a=0.5; +n=0:9; +for i = 0:9 + x(i+1) = (a*exp(-%i*%pi))^i; +end + +//The DTFT of the sequence +K = 4; +k = 0:4/1000:4; +W = k*6*%pi/K; +X = (x')*exp(%i*n'*W); +X_mag = abs(X); +X_phase = phasemag(X); + +//PLOTTING GRAPHS FOR THE INTERVAL OF 0 TO 6*%pi +clf(); +a=gca(); +figure(0); +plot2d3(mtlb_fliplr(W),X_mag); +xtitle('Magnitude response','W','Amplitude'); +figure(1); +plot2d3(mtlb_fliplr(W),X_phase); +xtitle('Phase response','W','X_phase,degrees'); + + + + + + + + + + + + + diff --git a/692/CH3/EX3.13/P3_13.sce b/692/CH3/EX3.13/P3_13.sce new file mode 100755 index 000000000..4b3b29de3 --- /dev/null +++ b/692/CH3/EX3.13/P3_13.sce @@ -0,0 +1,33 @@ +//EXAMPLE 3.13 + +clc; +clear; +a=0.5; +n=0:9; +for i = 0:9 + x(i+1) = a^i; +end +//The DTFT of the sequence +K = 4; +k = 0:4/1000:4; +W = k*6*%pi/K; +X1 = (x')*exp(%i*n'*W); +X = %i*diff(X1); +X = [X,0] + X1; + +X_mag = abs(X); +[X_phase,db] = phasemag(X); + +clf(); +a=gca(); +figure(0); +plot2d3(mtlb_fliplr(W),X_mag); +xtitle('Magnitude response','W','X_mag'); +figure(1); +plot2d3(mtlb_fliplr(W),X_phase); +xtitle('Phase response','W','X_phase'); + + + + + diff --git a/692/CH3/EX3.14/P3_14.sce b/692/CH3/EX3.14/P3_14.sce new file mode 100755 index 000000000..c8897bdff --- /dev/null +++ b/692/CH3/EX3.14/P3_14.sce @@ -0,0 +1,25 @@ +//EXAMPLE 3.14 +//ENERGY OF LP DISCREET TIME SIGNAL +//PROGRAM REQUIRES MAXIMA SCILAB TOOLBOX +clc; +clear; +syms n wc w; + wc = input("the value of wc ( less than %pi)= "); +n = -5:0.05:5; + +for i =0:length (n) + hlp(i+1) = (wc/%pi)*sinc((wc*i)/%pi); + E(i+1)=(abs(hlp(i+1)))^2; +end + +Energy = sum(E); + if (Energy<%inf ) then + disp ('The filter is Energy Signal') ; + else + if (Energy/length(N)<%inf ) then + disp ('Power Signal') ; + else + disp ('Niether Energy nor Power Signal') ; + end + end +disp(Energy,'the energy is = ');
\ No newline at end of file diff --git a/692/CH3/EX3.15/P3_15.sce b/692/CH3/EX3.15/P3_15.sce new file mode 100755 index 000000000..f9e52fd28 --- /dev/null +++ b/692/CH3/EX3.15/P3_15.sce @@ -0,0 +1,13 @@ +//EXAMPLE 3.15 +//ENERGY OF A SIGNAL x[n]=a^n*u[n] +clc; +clear; +a=0.5; +n=0:0.1:9.9; +//x[n]=a^n*u[n] +for i = 0:length(n) + x(i+1) = a^i; + E=(abs(x))^2; +end +Energy=sum(E); +disp(Energy,'Energy of the signal = ');
\ No newline at end of file diff --git a/692/CH3/EX3.5/P3_5.sce b/692/CH3/EX3.5/P3_5.sce new file mode 100755 index 000000000..0a949b858 --- /dev/null +++ b/692/CH3/EX3.5/P3_5.sce @@ -0,0 +1,27 @@ +//EXAMPLE 3.5 +//DTFT of unit sample sequence +clc; +clear; +//a=0.5; +n=0:9; +x = [1,zeros(1,9)]; +disp(x,'x[n] = ') + +K = 4; +k = 0:4/1000:4; +W = k*2*%pi/K; +X = (x)*exp(%i*n'*W); +disp(X,'DTFT,x[n] --> ') +X_mag = abs(X); +X_phase = phasemag(X);//no phase exists + +figure(0); +plot2d3(mtlb_fliplr(W),X_mag); +xtitle('Magnitude plot','W --->','X_mag --->'); +figure(1); +plot2d3(mtlb_fliplr(W),X_phase); +xtitle(' zero phase plot','W --->','X_phase --->'); + + + + diff --git a/692/CH3/EX3.6/P3_6.sce b/692/CH3/EX3.6/P3_6.sce new file mode 100755 index 000000000..c2d1f649a --- /dev/null +++ b/692/CH3/EX3.6/P3_6.sce @@ -0,0 +1,48 @@ +//EXAMPLE 3.6 +//Determine DTFT of sequence +//PROGRAM REQUIRES MAXIMA SCILAB TOOLBOX + +clc; +clear; +//Symbolic calculation +Syms n w a ; +x1=(a^n)*exp(-%i*n*w); +X1=nusum(x1,n,0,%inf); +disp(X1,'DFT,X = '); + +//Given: +a=0.5; +n=0:9; +//x[n]=a^n*u[n] +for i = 0:9 + x(i+1) = a^i; +end +//The DTFT of the sequence +K = 4; +k = 0:4/1000:4; +W = k*6*%pi/K; +X = (x')*exp(%i*n'*W); +X_mag = abs(X); +[X_phase,db] = phasemag(X); + +clf(); +a=gca(); +figure(0); +//Note %pi ~ 3.14 +plot2d3(mtlb_fliplr(W),X_mag); +xtitle('Magnitude response','W --->','Amplitude --->'); +figure(1); +plot2d3(mtlb_fliplr(W),X_phase); +xtitle('Phase response','W --->','Phase in degrees --->'); + + + + + + + + + + + + diff --git a/692/CH3/EX3.7/P3_12.sce b/692/CH3/EX3.7/P3_12.sce new file mode 100755 index 000000000..35c37dc00 --- /dev/null +++ b/692/CH3/EX3.7/P3_12.sce @@ -0,0 +1,42 @@ +//EXAMPLE 3.12 +//x[n]=((-1)^n)*(a^n)*u[n].....given a=0.5; + +clc; +clear; + +a=0.5; +n=0:9; +for i = 0:9 + x(i+1) = (a*exp(-%i*%pi))^i; +end + +//The DTFT of the sequence +K = 4; +k = 0:4/1000:4; +W = k*6*%pi/K; +X = (x')*exp(%i*n'*W); +X_mag = abs(X); +X_phase = phasemag(X); + +//PLOTTING GRAPHS FOR THE INTERVAL OF 0 TO 6*%pi +clf(); +a=gca(); +figure(0); +plot2d3(mtlb_fliplr(W),X_mag); +xtitle('Magnitude response','W','Amplitude'); +figure(1); +plot2d3(mtlb_fliplr(W),X_phase); +xtitle('Phase response','W','X_phase,degrees'); + + + + + + + + + + + + + |