From b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b Mon Sep 17 00:00:00 2001 From: priyanka Date: Wed, 24 Jun 2015 15:03:17 +0530 Subject: initial commit / add all books --- 40/CH8/EX8.1/Exa_8_1.sce | 6 ++++++ 40/CH8/EX8.10/Exa_8_10.sce | 9 +++++++++ 40/CH8/EX8.11/Exa_8_11.sce | 27 +++++++++++++++++++++++++++ 40/CH8/EX8.11/Exa_8_11_0.jpg | Bin 0 -> 14316 bytes 40/CH8/EX8.11/Exa_8_11_1.jpg | Bin 0 -> 18501 bytes 40/CH8/EX8.15a/Exa_8_15a.sce | 12 ++++++++++++ 40/CH8/EX8.15b/Exa_8_15b.sce | 14 ++++++++++++++ 40/CH8/EX8.16/Exa_8_16.jpg | Bin 0 -> 12762 bytes 40/CH8/EX8.16/Exa_8_16.sce | 12 ++++++++++++ 40/CH8/EX8.17/Exa_8_17.sce | 8 ++++++++ 40/CH8/EX8.18/Exa_8_18.sce | 9 +++++++++ 40/CH8/EX8.19/Exa_8_19.sce | 10 ++++++++++ 40/CH8/EX8.2/Exa_8_2.sce | 6 ++++++ 40/CH8/EX8.20/Exa_8_20.sce | 9 +++++++++ 40/CH8/EX8.21/Exa_8_21.sce | 11 +++++++++++ 40/CH8/EX8.22/Exa_8_22.sce | 9 +++++++++ 40/CH8/EX8.23/Exa_8_23.sce | 10 ++++++++++ 40/CH8/EX8.24/Exa_8_24.sce | 24 ++++++++++++++++++++++++ 40/CH8/EX8.3/Exa_8_3.sce | 24 ++++++++++++++++++++++++ 40/CH8/EX8.4/Exa_8_4.sce | 21 +++++++++++++++++++++ 40/CH8/EX8.5a/Exa_8_5a.sce | 42 ++++++++++++++++++++++++++++++++++++++++++ 40/CH8/EX8.5b/Exa_8_5b.sce | 42 ++++++++++++++++++++++++++++++++++++++++++ 40/CH8/EX8.5c/Exa_8_5c.sce | 7 +++++++ 40/CH8/EX8.6/Exa_8_6.sce | 20 ++++++++++++++++++++ 40/CH8/EX8.7/Exa_8_7.sce | 7 +++++++ 40/CH8/EX8.8/Exa_8_8.sce | 9 +++++++++ 40/CH8/EX8.9a/Exa_8_9a.sce | 15 +++++++++++++++ 40/CH8/EX8.9a/Exa_8_9a_0.jpg | Bin 0 -> 15251 bytes 40/CH8/EX8.9a/Exa_8_9a_1.jpg | Bin 0 -> 10575 bytes 40/CH8/EX8.9b/Exa_8_9b.sce | 15 +++++++++++++++ 40/CH8/EX8.9b/Exa_8_9b_0.jpg | Bin 0 -> 18100 bytes 40/CH8/EX8.9b/Exa_8_9b_1.jpg | Bin 0 -> 11424 bytes 40/CH8/EX8.9c/Exa_8_9c.sce | 15 +++++++++++++++ 40/CH8/EX8.9c/Exa_8_9c_0.jpg | Bin 0 -> 16233 bytes 40/CH8/EX8.9c/Exa_8_9c_1.jpg | Bin 0 -> 10728 bytes 40/CH8/EX8.9d/Exa_8_9d.sce | 15 +++++++++++++++ 40/CH8/EX8.9d/Exa_8_9d_1.jpg | Bin 0 -> 13206 bytes 40/CH8/EX8.9d/exa_8_9d_0.jpg | Bin 0 -> 15701 bytes 38 files changed, 408 insertions(+) create mode 100755 40/CH8/EX8.1/Exa_8_1.sce create mode 100755 40/CH8/EX8.10/Exa_8_10.sce create mode 100755 40/CH8/EX8.11/Exa_8_11.sce create mode 100755 40/CH8/EX8.11/Exa_8_11_0.jpg create mode 100755 40/CH8/EX8.11/Exa_8_11_1.jpg create mode 100755 40/CH8/EX8.15a/Exa_8_15a.sce create mode 100755 40/CH8/EX8.15b/Exa_8_15b.sce create mode 100755 40/CH8/EX8.16/Exa_8_16.jpg create mode 100755 40/CH8/EX8.16/Exa_8_16.sce create mode 100755 40/CH8/EX8.17/Exa_8_17.sce create mode 100755 40/CH8/EX8.18/Exa_8_18.sce create mode 100755 40/CH8/EX8.19/Exa_8_19.sce create mode 100755 40/CH8/EX8.2/Exa_8_2.sce create mode 100755 40/CH8/EX8.20/Exa_8_20.sce create mode 100755 40/CH8/EX8.21/Exa_8_21.sce create mode 100755 40/CH8/EX8.22/Exa_8_22.sce create mode 100755 40/CH8/EX8.23/Exa_8_23.sce create mode 100755 40/CH8/EX8.24/Exa_8_24.sce create mode 100755 40/CH8/EX8.3/Exa_8_3.sce create mode 100755 40/CH8/EX8.4/Exa_8_4.sce create mode 100755 40/CH8/EX8.5a/Exa_8_5a.sce create mode 100755 40/CH8/EX8.5b/Exa_8_5b.sce create mode 100755 40/CH8/EX8.5c/Exa_8_5c.sce create mode 100755 40/CH8/EX8.6/Exa_8_6.sce create mode 100755 40/CH8/EX8.7/Exa_8_7.sce create mode 100755 40/CH8/EX8.8/Exa_8_8.sce create mode 100755 40/CH8/EX8.9a/Exa_8_9a.sce create mode 100755 40/CH8/EX8.9a/Exa_8_9a_0.jpg create mode 100755 40/CH8/EX8.9a/Exa_8_9a_1.jpg create mode 100755 40/CH8/EX8.9b/Exa_8_9b.sce create mode 100755 40/CH8/EX8.9b/Exa_8_9b_0.jpg create mode 100755 40/CH8/EX8.9b/Exa_8_9b_1.jpg create mode 100755 40/CH8/EX8.9c/Exa_8_9c.sce create mode 100755 40/CH8/EX8.9c/Exa_8_9c_0.jpg create mode 100755 40/CH8/EX8.9c/Exa_8_9c_1.jpg create mode 100755 40/CH8/EX8.9d/Exa_8_9d.sce create mode 100755 40/CH8/EX8.9d/Exa_8_9d_1.jpg create mode 100755 40/CH8/EX8.9d/exa_8_9d_0.jpg (limited to '40/CH8') diff --git a/40/CH8/EX8.1/Exa_8_1.sce b/40/CH8/EX8.1/Exa_8_1.sce new file mode 100755 index 000000000..000b8b907 --- /dev/null +++ b/40/CH8/EX8.1/Exa_8_1.sce @@ -0,0 +1,6 @@ +//DFT from defining relation +//N-point DFT +x=[1 2 1 0]; +XDFT=dft(x,-1); +disp(XDFT,'The DFT of x[n] is'); +//DFT of periodic signal x with period N=4 \ No newline at end of file diff --git a/40/CH8/EX8.10/Exa_8_10.sce b/40/CH8/EX8.10/Exa_8_10.sce new file mode 100755 index 000000000..d9676ae26 --- /dev/null +++ b/40/CH8/EX8.10/Exa_8_10.sce @@ -0,0 +1,9 @@ +//DFS of sampled periodic signals +xn=[0 ones(2:16) 0 -ones(18:32)]; +XDFS=0.032*dft(xn,-1); +for i=1:length(XDFS) + if (abs(XDFS(i))<0.000001) then + XDFS(i)=0; + end +end +disp(XDFS,'The DFS of x[n] is'); \ No newline at end of file diff --git a/40/CH8/EX8.11/Exa_8_11.sce b/40/CH8/EX8.11/Exa_8_11.sce new file mode 100755 index 000000000..5b086398e --- /dev/null +++ b/40/CH8/EX8.11/Exa_8_11.sce @@ -0,0 +1,27 @@ +//Effects of leakage +n1=0:0.005:0.1; +n2=0:0.005:0.125; +n3=0:0.005:1.125; +xt1=(2*cos(20*%pi*n1')+5*cos(100*%pi*n1')); +xt2=(2*cos(20*%pi*n2')+5*cos(100*%pi*n2')); +xt3=(2*cos(20*%pi*n3')+5*cos(100*%pi*n3')); +XDFS1=abs(dft(xt1,-1))/20; +XDFS2=abs(dft(xt2,-1))/25; +XDFS3=abs(dft(xt3,-1))/225; +f1=0:5:100; +f2=0:4:100; +f3=0:100/225:100; +a=gca(); +a.x_location="origin"; +plot2d3('gnn',f1,XDFS1); +xlabel('analog frequency'); +ylabel('Magnitude'); +xset('window',1); +subplot(211); +plot2d3('gnn',f2,XDFS2); +xlabel('analog frequency'); +ylabel('Magnitude'); +subplot(212); +plot2d3('gnn',f3,XDFS3); +xlabel('analog frequency'); +ylabel('Magnitude'); \ No newline at end of file diff --git a/40/CH8/EX8.11/Exa_8_11_0.jpg b/40/CH8/EX8.11/Exa_8_11_0.jpg new file mode 100755 index 000000000..776d7a686 Binary files /dev/null and b/40/CH8/EX8.11/Exa_8_11_0.jpg differ diff --git a/40/CH8/EX8.11/Exa_8_11_1.jpg b/40/CH8/EX8.11/Exa_8_11_1.jpg new file mode 100755 index 000000000..e0746b696 Binary files /dev/null and b/40/CH8/EX8.11/Exa_8_11_1.jpg differ diff --git a/40/CH8/EX8.15a/Exa_8_15a.sce b/40/CH8/EX8.15a/Exa_8_15a.sce new file mode 100755 index 000000000..5905d9dbe --- /dev/null +++ b/40/CH8/EX8.15a/Exa_8_15a.sce @@ -0,0 +1,12 @@ +//overlapp-add and overlap-save methods of convolution +//overlap-add method +xn=[1 2 3 3 4 5]; +xon=[1 2 3]; +x1n=[3 4 5]; +hn=[1 1 1]; +yon=convol(xon,hn); +y1n=convol(x1n,hn); +yon=[yon,0,0,0]; +y1n=[0,0,0,y1n]; +yn=yon+y1n +yn1=convol(xn,hn) \ No newline at end of file diff --git a/40/CH8/EX8.15b/Exa_8_15b.sce b/40/CH8/EX8.15b/Exa_8_15b.sce new file mode 100755 index 000000000..b72139b8c --- /dev/null +++ b/40/CH8/EX8.15b/Exa_8_15b.sce @@ -0,0 +1,14 @@ +//(b)overlap-save method +xn=[1 2 3 3 4 5]; +hn=[1 1 1]; +xon=[0 0 1 2 3]; +x1n=[2 3 3 4 5]; +x2n=[4 5 0 0 0]; +yon=convol(xon,hn); +y1n=convol(x1n,hn); +y2n=convol(x2n,hn); +yno=yon(3:5); +yn1=y1n(3:5); +yn2=y2n(3:5); +yn=[yno yn1 yn2] +YN=convol(xn,hn) \ No newline at end of file diff --git a/40/CH8/EX8.16/Exa_8_16.jpg b/40/CH8/EX8.16/Exa_8_16.jpg new file mode 100755 index 000000000..4a4bb37f1 Binary files /dev/null and b/40/CH8/EX8.16/Exa_8_16.jpg differ diff --git a/40/CH8/EX8.16/Exa_8_16.sce b/40/CH8/EX8.16/Exa_8_16.sce new file mode 100755 index 000000000..4bd0eb54e --- /dev/null +++ b/40/CH8/EX8.16/Exa_8_16.sce @@ -0,0 +1,12 @@ +//signal interpolation using FFT +xn=[0 1 0 -1]; +XDFT=dft(xn,-1) +ZT=[0 -2*%i 0 zeros(1:27) 0 2*%i]; +xn1=dft(ZT,1); +t=0:1/length(xn1):1-(1/length(xn1)); +a=gca(); +a.x_location="origin"; +plot2d(t,xn1); +xlabel('time t'); +ylabel('Amplitude'); +xtitle('Interpolated Sinusoid:4 samples over one period'); \ No newline at end of file diff --git a/40/CH8/EX8.17/Exa_8_17.sce b/40/CH8/EX8.17/Exa_8_17.sce new file mode 100755 index 000000000..10f457b52 --- /dev/null +++ b/40/CH8/EX8.17/Exa_8_17.sce @@ -0,0 +1,8 @@ +//concept of periodogram +xn=[0 1 0 -1]; +N=4; +XDFT=dft(xn,-1); +for i=1:length(XDFT) + p(i)=(1/N)*abs(XDFT(i)^2); +end +p//periodogram \ No newline at end of file diff --git a/40/CH8/EX8.18/Exa_8_18.sce b/40/CH8/EX8.18/Exa_8_18.sce new file mode 100755 index 000000000..c05785204 --- /dev/null +++ b/40/CH8/EX8.18/Exa_8_18.sce @@ -0,0 +1,9 @@ +//The DFT from the matrix formulation +xn=[1;2;1;0]; +w=exp(-%i*%pi/2); +for i=1:4 + for j=1:4 + WN(i,j)=w^((i-1)*(j-1)); + end +end +XDFT=WN*xn diff --git a/40/CH8/EX8.19/Exa_8_19.sce b/40/CH8/EX8.19/Exa_8_19.sce new file mode 100755 index 000000000..77fcc0e9e --- /dev/null +++ b/40/CH8/EX8.19/Exa_8_19.sce @@ -0,0 +1,10 @@ +//using DFT to find IDFT +XDFT=[4;-2*%i;0;2*%i]; +XDFTc=[4;2*%i;0;-2*%i]; +w=exp(-%i*%pi/2); +for i=1:4 + for j=1:4 + WN(i,j)=w^((i-1)*(j-1)); + end +end +xn=1/4*(WN*XDFTc) \ No newline at end of file diff --git a/40/CH8/EX8.2/Exa_8_2.sce b/40/CH8/EX8.2/Exa_8_2.sce new file mode 100755 index 000000000..39450d7f1 --- /dev/null +++ b/40/CH8/EX8.2/Exa_8_2.sce @@ -0,0 +1,6 @@ +//The DTFT and conjugate symmetry +//8-point DFT +x=[1 1 0 0 0 0 0 0]; +XDFT=dft(x,-1); +disp(XDFT,'The DFT of x is'); +disp('from conjugate symmetry we see XDFT[k]=XDFT[8-k]'); \ No newline at end of file diff --git a/40/CH8/EX8.20/Exa_8_20.sce b/40/CH8/EX8.20/Exa_8_20.sce new file mode 100755 index 000000000..a87b49079 --- /dev/null +++ b/40/CH8/EX8.20/Exa_8_20.sce @@ -0,0 +1,9 @@ +//A four point decimation-in-frequency FFT algorithm +x=[1 2 1 0]; +w=-%i; +xdft(1)=x(1)+x(3)+x(2)+x(4); +xdft(2)=x(1)-x(3)+w*(x(2)-x(4)); +xdft(3)=x(1)+x(3)-x(2)-x(4); +xdft(4)=x(1)-x(3)-w*(x(2)-x(4)); +XDFT=dft(x,-1); +xdft,XDFT \ No newline at end of file diff --git a/40/CH8/EX8.21/Exa_8_21.sce b/40/CH8/EX8.21/Exa_8_21.sce new file mode 100755 index 000000000..0014814a8 --- /dev/null +++ b/40/CH8/EX8.21/Exa_8_21.sce @@ -0,0 +1,11 @@ +//A four point decimation-in-time FFT algorithm +x=[1 2 1 0]; +w=-%i; +xdft=[0 0 0 0]; +for i=1:4 + for j=1:4 + xdft(i)=xdft(i)+x(j)*w^((i-1)*(j-1)); + end +end +XDFT=dft(x,-1); +xdft,XDFT \ No newline at end of file diff --git a/40/CH8/EX8.22/Exa_8_22.sce b/40/CH8/EX8.22/Exa_8_22.sce new file mode 100755 index 000000000..3cc472315 --- /dev/null +++ b/40/CH8/EX8.22/Exa_8_22.sce @@ -0,0 +1,9 @@ +//A 4-point DFT from a 3-point sequence +xn=[1;2;1]; +w=exp(-%i*%pi/2); +for i=1:4 + for j=1:3 + WN(i,j)=w^((i-1)*(j-1)); + end +end +XDFT=WN*xn \ No newline at end of file diff --git a/40/CH8/EX8.23/Exa_8_23.sce b/40/CH8/EX8.23/Exa_8_23.sce new file mode 100755 index 000000000..4a6985f9e --- /dev/null +++ b/40/CH8/EX8.23/Exa_8_23.sce @@ -0,0 +1,10 @@ +//A 3-point IDFT from 4-point DFT +XDFT=[4;-2*%i;0;2*%i]; +w=exp(-%i*%pi/2); +for i=1:4 + for j=1:3 + WN(i,j)=w^((i-1)*(j-1)); + end +end +WI=WN'; +xn=1/4*(WI*XDFT) \ No newline at end of file diff --git a/40/CH8/EX8.24/Exa_8_24.sce b/40/CH8/EX8.24/Exa_8_24.sce new file mode 100755 index 000000000..5ad54e146 --- /dev/null +++ b/40/CH8/EX8.24/Exa_8_24.sce @@ -0,0 +1,24 @@ +//The importance of Periodic extension +//(a)For M=3 +x=[1 2 1]; +XDFT=dft(x,-1) +w=exp(-%i*2*%pi/3); +for i=1:3 + for j=1:3 + WN(i,j)=w^((i-1)*(j-1)); + end +end +WI=WN'; +xn=1/3*WI*XDFT +//The result is periodic with M=3 & 1 period equals x[n] +//(b)For M=4 +y=[1 2 1 0]; +YDFT=dft(y,-1) +w=exp(-%i*%pi/2); +for i=1:4 + for j=1:4 + WN(i,j)=w^((i-1)*(j-1)); + end +end +WI=WN'; +yn=1/4*WI*YDFT diff --git a/40/CH8/EX8.3/Exa_8_3.sce b/40/CH8/EX8.3/Exa_8_3.sce new file mode 100755 index 000000000..fcf7eb76f --- /dev/null +++ b/40/CH8/EX8.3/Exa_8_3.sce @@ -0,0 +1,24 @@ +//Circular shift and flipping +//(a)right circular shift +y=[1 2 3 4 5 0 0 6]; +f=y;g=y;h=y; +for i=1:2 + b=f(length(f)); + for j=length(f):-1:2 + f(j)=f(j-1); + end + f(1)=b; +end +disp(f,'By right circular shift y[n-2] is'); +//(b)left circular shift +for i=1:2 + a=g(1); + for j=1:length(g)-1 + g(j)=g(j+1); + end + g(length(g))=a; +end +disp(g,'By left circular shift y[n+2] is'); +//(c)flipping property +h=[h(1) h(length(h):-1:2)]; +disp(h,'By flipping property y[-n] is'); \ No newline at end of file diff --git a/40/CH8/EX8.4/Exa_8_4.sce b/40/CH8/EX8.4/Exa_8_4.sce new file mode 100755 index 000000000..847b1bfa2 --- /dev/null +++ b/40/CH8/EX8.4/Exa_8_4.sce @@ -0,0 +1,21 @@ +x=[1 2 1 0]; +XDFT=dft(x,-1) +//(a)time shift property +y=x; +for i=1:2 + a=y(1); + for j=1:length(y)-1 + y(j)=y(j+1); + end + y(length(y))=a; +end +YDFT=dft(y,-1) +disp(YDFT,'By Time-Shift property DFT of x[n-2] is'); +//(b)flipping property +g=[x(1) x(length(x):-1:2)] +GDFT=dft(g,-1) +disp(GDFT,'By Time reversal property DFT of x[-n] is'); +//(c)conjugation property +p=XDFT; +PDFT=[p(1);p(4:-1:2)]; +disp(YDFT,'BY conjugation property DFT of x*[n] is'); diff --git a/40/CH8/EX8.5a/Exa_8_5a.sce b/40/CH8/EX8.5a/Exa_8_5a.sce new file mode 100755 index 000000000..63e5aa5a4 --- /dev/null +++ b/40/CH8/EX8.5a/Exa_8_5a.sce @@ -0,0 +1,42 @@ +//properties of DFT +//a1)product +xn=[1 2 1 0]; +XDFT=dft(xn,-1) +hn=xn.*xn +HDFT=dft(hn,-1) +HDFT1=1/4*(convol(XDFT,XDFT)) +HDFT1=[HDFT1,zeros(8:12)]; +HDFT2=[HDFT1(1:4);HDFT1(5:8);HDFT1(9:12)]; +HDFT3=[0 0 0 0]; +for i=1:4 + for j=1:3 + HDFT3(i)=HDFT3(i)+HDFT2(j,i); + end +end +disp(HDFT3,'DFT of x[n]^2 is'); +//a2)periodic convolution +vn=convol(xn,xn); +vn=[vn,zeros(8:12)]; +vn=[vn(1:4);vn(5:8);vn(9:12)]; +vn1=[0 0 0 0]; +for i=1:4 + for j=1:3 + vn1(i)=vn1(i)+vn(j,i); + end +end +VDFT=dft(vn1,-1); +VDFT1=XDFT.*XDFT; +disp(VDFT1,'DFT of x[n]*x[n] is'); +//a3)signal energy(parcewell's theorem) +xn2=xn^2; +E=0; +for i=1:length(xn2) + E=E+abs(xn2(i)); +end +XDFT2=XDFT^2 +E1=0; +for i=1:length(XDFT2) + E1=E1+abs(XDFT2(i)); +end +E,(1/4)*E1; +disp(1/4*E1,'The energy of the signal is'); \ No newline at end of file diff --git a/40/CH8/EX8.5b/Exa_8_5b.sce b/40/CH8/EX8.5b/Exa_8_5b.sce new file mode 100755 index 000000000..05c7e80c0 --- /dev/null +++ b/40/CH8/EX8.5b/Exa_8_5b.sce @@ -0,0 +1,42 @@ +//b1)modulation +XDFT=[4 -2*%i 0 2*%i]; +xn=dft(XDFT,1) +for i=1:length(xn) + zn(i)=xn(i)*%e^((%i*%pi*(i-1))/2); +end +disp(zn,'The IDFT of XDFT[k-1] is'); +ZDFT=[2*%i 4 -2*%i 0]; +zn1=dft(ZDFT,1) +//b2)periodic convolution +HDFT=(convol(XDFT,XDFT)) +HDFT=[HDFT,zeros(8:12)]; +HDFT=[HDFT(1:4);HDFT(5:8);HDFT(9:12)]; +HDFT1=[0 0 0 0]; +for i=1:4 + for j=1:3 + HDFT1(i)=HDFT1(i)+HDFT(j,i); + end +end +HDFT1; +hn=dft(HDFT1,1) +hn1=4*(xn.*xn); +disp(hn1,'The IDFT of XDFT*XDFT is'); +//b3)product +WDFT=XDFT.*XDFT; +wn=dft(WDFT,1) +wn1=convol(xn,xn); +wn1=[wn1,zeros(8:12)]; +wn1=[wn1(1:4);wn1(5:8);wn1(9:12)]; +WN=[0 0 0 0]; +for i=1:4 + for j=1:3 + WN(i)=WN(i)+wn1(j,i); + end +end +disp(WN,'The IDFT of XDFT.XDFT is'); +//b4)Central ordinates and signal Energy +E=0; +for i=1:length(xn) + E=E+abs(xn(i)^2); +end +disp(E,'the signal energy is'); \ No newline at end of file diff --git a/40/CH8/EX8.5c/Exa_8_5c.sce b/40/CH8/EX8.5c/Exa_8_5c.sce new file mode 100755 index 000000000..bc4c62f5d --- /dev/null +++ b/40/CH8/EX8.5c/Exa_8_5c.sce @@ -0,0 +1,7 @@ +//Regular convolution +xn=[1 2 1 0]; +yn=[1 2 1 0 0 0 0]; +YDFT=dft(yn,-1) +SDFT=YDFT.*YDFT +sn=dft(SDFT,1) +sn1=convol(xn,xn) \ No newline at end of file diff --git a/40/CH8/EX8.6/Exa_8_6.sce b/40/CH8/EX8.6/Exa_8_6.sce new file mode 100755 index 000000000..be5c3cbb9 --- /dev/null +++ b/40/CH8/EX8.6/Exa_8_6.sce @@ -0,0 +1,20 @@ +//Signal and spectrum replication +xn=[2 3 2 1]; +XDFT=dft(xn,-1) +yn=[xn xn xn]; +YDFT=dft(yn,-1) +YDFT1=3*[XDFT(1:1/3:length(XDFT))]; +for i=2:3 + YDFT1(i:3:length(YDFT1))=0; +end +YDFT1(12:-1:11)=0; +disp(YDFT1,'the DFT of x[n/3] is'); +hn=[xn(1:1/3:length(xn))] +for i=2:3 + hn(i:3:length(hn))=0; +end +hn(12:-1:11)=0; +hn +HDFT=dft(hn,-1) +HDFT1=[XDFT;XDFT;XDFT]; +disp(HDFT1,'the DFT of y[n]=[x[n],x[n],x[n]] is'); \ No newline at end of file diff --git a/40/CH8/EX8.7/Exa_8_7.sce b/40/CH8/EX8.7/Exa_8_7.sce new file mode 100755 index 000000000..9d9c9e16d --- /dev/null +++ b/40/CH8/EX8.7/Exa_8_7.sce @@ -0,0 +1,7 @@ +//relating DFT and IDFT +XDFT1=[4 -2*%i 0 2*%i]; +xn1=dft(XDFT1,1); +disp(xn1,'The IDFT of XDFT1'); +XDFT2=[12 -24*%i 0 4*%e^(%i*%pi/4) 0 4*%e^(-%i*%pi/4) 0 24*%i]; +xn2=dft(XDFT2,1); +disp(xn2,'The IDFT of XDFT1'); \ No newline at end of file diff --git a/40/CH8/EX8.8/Exa_8_8.sce b/40/CH8/EX8.8/Exa_8_8.sce new file mode 100755 index 000000000..7fad7f114 --- /dev/null +++ b/40/CH8/EX8.8/Exa_8_8.sce @@ -0,0 +1,9 @@ +//Relating DFT and DTFT +xn=[1 2 1 0]; +XDFT=dft(xn,-1); +//for F=k/4,k=0,1,2,3 +for k=1:4 + XF(k)=1+2*%e^(-%i*%pi*(k-1)/2)+%e^(-%i*%pi*(k-1)); +end +XF,XDFT +disp(XF,'The DFT of x[n] is'); diff --git a/40/CH8/EX8.9a/Exa_8_9a.sce b/40/CH8/EX8.9a/Exa_8_9a.sce new file mode 100755 index 000000000..b61b2c4d9 --- /dev/null +++ b/40/CH8/EX8.9a/Exa_8_9a.sce @@ -0,0 +1,15 @@ +//DFT and DFS of sinusoids +n2=0:0.5/1000:5.5/100; +xt=4*cos(100*%pi*n2'); +n=0:(0.5)/100:(5.5)/100;//F=3/12 hence N=12 +xn=4*cos(100*%pi*n'); +XDFT=dft(xn,-1); +n1=0:11; +a=gca(); +a.x_location="origin"; +plot2d(n2,xt); +plot2d3('gnn',n,xn); +xset('window',1); +b=gca(); +b.x_location="origin"; +plot2d3('gnn',n1,XDFT); diff --git a/40/CH8/EX8.9a/Exa_8_9a_0.jpg b/40/CH8/EX8.9a/Exa_8_9a_0.jpg new file mode 100755 index 000000000..7d2fad5b0 Binary files /dev/null and b/40/CH8/EX8.9a/Exa_8_9a_0.jpg differ diff --git a/40/CH8/EX8.9a/Exa_8_9a_1.jpg b/40/CH8/EX8.9a/Exa_8_9a_1.jpg new file mode 100755 index 000000000..b0bd756d8 Binary files /dev/null and b/40/CH8/EX8.9a/Exa_8_9a_1.jpg differ diff --git a/40/CH8/EX8.9b/Exa_8_9b.sce b/40/CH8/EX8.9b/Exa_8_9b.sce new file mode 100755 index 000000000..d32e7094c --- /dev/null +++ b/40/CH8/EX8.9b/Exa_8_9b.sce @@ -0,0 +1,15 @@ +//DFT and DFS of sinusoids +n2=0:1/1280:31/128; +xt=4*sin(72*%pi*n2'); +n=0:1/128:31/128;//F=9/32 hence N=32 +xn=4*sin(72*%pi*n'); +XDFT=abs(dft(xn,-1)); +n1=0:31; +a=gca(); +a.x_location="origin"; +plot2d(n2,xt); +plot2d3('gnn',n,xn); +xset('window',1); +b=gca(); +b.x_location="origin"; +plot2d3('gnn',n1,XDFT); diff --git a/40/CH8/EX8.9b/Exa_8_9b_0.jpg b/40/CH8/EX8.9b/Exa_8_9b_0.jpg new file mode 100755 index 000000000..3ae80d7a6 Binary files /dev/null and b/40/CH8/EX8.9b/Exa_8_9b_0.jpg differ diff --git a/40/CH8/EX8.9b/Exa_8_9b_1.jpg b/40/CH8/EX8.9b/Exa_8_9b_1.jpg new file mode 100755 index 000000000..e757639cc Binary files /dev/null and b/40/CH8/EX8.9b/Exa_8_9b_1.jpg differ diff --git a/40/CH8/EX8.9c/Exa_8_9c.sce b/40/CH8/EX8.9c/Exa_8_9c.sce new file mode 100755 index 000000000..67632bb96 --- /dev/null +++ b/40/CH8/EX8.9c/Exa_8_9c.sce @@ -0,0 +1,15 @@ +//DFT and DFS of sinusoids +n2=0:1/840:6/21; +xt=4*sin(72*%pi*n2')-6*cos(12*%pi*n2'); +n=0:1/21:6/21;//F=3/12 hence N=12 +xn=4*sin(72*%pi*n')-6*cos(12*%pi*n'); +XDFT=abs(dft(xn,-1)); +n1=0:6; +a=gca(); +a.x_location="origin"; +plot2d(n2,xt); +plot2d3('gnn',n,xn); +xset('window',1); +b=gca(); +b.x_location="origin"; +plot2d3('gnn',n1,XDFT); diff --git a/40/CH8/EX8.9c/Exa_8_9c_0.jpg b/40/CH8/EX8.9c/Exa_8_9c_0.jpg new file mode 100755 index 000000000..924bb1475 Binary files /dev/null and b/40/CH8/EX8.9c/Exa_8_9c_0.jpg differ diff --git a/40/CH8/EX8.9c/Exa_8_9c_1.jpg b/40/CH8/EX8.9c/Exa_8_9c_1.jpg new file mode 100755 index 000000000..55efa132d Binary files /dev/null and b/40/CH8/EX8.9c/Exa_8_9c_1.jpg differ diff --git a/40/CH8/EX8.9d/Exa_8_9d.sce b/40/CH8/EX8.9d/Exa_8_9d.sce new file mode 100755 index 000000000..2d5d4b294 --- /dev/null +++ b/40/CH8/EX8.9d/Exa_8_9d.sce @@ -0,0 +1,15 @@ +//DFT and DFS of sinusoids +n2=0:1/2400:23/240; +xt=1+4*sin(120*%pi*n2')+4*sin(40*%pi*n2'); +n=0:1/240:23/240;//F=9/32 hence N=32 +xn=1+4*sin(120*%pi*n')+4*sin(40*%pi*n'); +XDFT=abs(dft(xn,-1)); +n1=0:23; +a=gca(); +a.x_location="origin"; +plot2d(n2,xt); +plot2d3('gnn',n,xn); +xset('window',1); +b=gca(); +b.x_location="origin"; +plot2d3('gnn',n1,XDFT); \ No newline at end of file diff --git a/40/CH8/EX8.9d/Exa_8_9d_1.jpg b/40/CH8/EX8.9d/Exa_8_9d_1.jpg new file mode 100755 index 000000000..baec0a646 Binary files /dev/null and b/40/CH8/EX8.9d/Exa_8_9d_1.jpg differ diff --git a/40/CH8/EX8.9d/exa_8_9d_0.jpg b/40/CH8/EX8.9d/exa_8_9d_0.jpg new file mode 100755 index 000000000..2d0969b63 Binary files /dev/null and b/40/CH8/EX8.9d/exa_8_9d_0.jpg differ -- cgit