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 /62/CH6 | |
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 '62/CH6')
77 files changed, 967 insertions, 0 deletions
diff --git a/62/CH6/EX6.11/ex_6_11.png b/62/CH6/EX6.11/ex_6_11.png Binary files differnew file mode 100755 index 000000000..f88d03b7c --- /dev/null +++ b/62/CH6/EX6.11/ex_6_11.png diff --git a/62/CH6/EX6.11/ex_6_11.sce b/62/CH6/EX6.11/ex_6_11.sce new file mode 100755 index 000000000..d96212f49 --- /dev/null +++ b/62/CH6/EX6.11/ex_6_11.sce @@ -0,0 +1,23 @@ +clear;
+close;
+clc;
+n=-10:10;
+a=2;
+for i=1:length(n)
+ if n(i)<=-1 then
+ x(i)=-2^n(i);
+ else
+ x(i)=0;
+ end
+end
+x=x';
+figure
+subplot(2,1,1)
+plot2d3(n,x);
+title("x[n]")
+plot(n,x,'r.')
+w=-10:0.1:10;
+Xw=x*exp(-%i*n'*w);
+subplot(2,1,2)
+plot2d(w,Xw);
+title("X[w] fourier transform")
diff --git a/62/CH6/EX6.12/ex_6_12.png b/62/CH6/EX6.12/ex_6_12.png Binary files differnew file mode 100755 index 000000000..09136f4c1 --- /dev/null +++ b/62/CH6/EX6.12/ex_6_12.png diff --git a/62/CH6/EX6.12/ex_6_12.sce b/62/CH6/EX6.12/ex_6_12.sce new file mode 100755 index 000000000..2a342c711 --- /dev/null +++ b/62/CH6/EX6.12/ex_6_12.sce @@ -0,0 +1,23 @@ +clear;
+close;
+clc;
+n=-10:10;
+N=5;
+for i=1:length(n)
+ if n(i)>=0 & n(i)<=N then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+x=x';
+figure
+subplot(2,1,1)
+plot2d3(n,x);
+title("x[n]")
+plot(n,x,'r.')
+w=-10:0.1:10;
+Xw=x*exp(-%i*n'*w);
+subplot(2,1,2)
+plot2d(w,Xw);
+title("X[w] fourier transform")
diff --git a/62/CH6/EX6.14/ex_6_14.sce b/62/CH6/EX6.14/ex_6_14.sce new file mode 100755 index 000000000..5ea8bd935 --- /dev/null +++ b/62/CH6/EX6.14/ex_6_14.sce @@ -0,0 +1,42 @@ +clear;
+close;
+clc;
+n=-10:10;
+N=4;
+for i=1:length(n)
+ if n(i)>=-N & n(i)<=N then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+x=x';
+figure
+subplot(2,1,1)
+plot2d3(n,x);
+title("x[n]")
+plot(n,x,'r.')
+w=-10:0.1:10;
+Xw=x*exp(-%i*n'*w);
+subplot(2,1,2)
+plot2d(w,Xw);
+title("X[w] fourier transform")
+N=8;
+for i=1:length(n)
+ if n(i)>=-N & n(i)<=N then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+x=x';
+figure
+subplot(2,1,1)
+plot2d3(n,x);
+title("x[n]")
+plot(n,x,'r.')
+w=-10:0.1:10;
+Xw=x'*exp(-%i*n'*w);
+subplot(2,1,2)
+plot2d(w,Xw);
+title("X[w] fourier transform")
diff --git a/62/CH6/EX6.14/ex_6_14a.png b/62/CH6/EX6.14/ex_6_14a.png Binary files differnew file mode 100755 index 000000000..8d0b4110d --- /dev/null +++ b/62/CH6/EX6.14/ex_6_14a.png diff --git a/62/CH6/EX6.14/ex_6_14b.png b/62/CH6/EX6.14/ex_6_14b.png Binary files differnew file mode 100755 index 000000000..e66691812 --- /dev/null +++ b/62/CH6/EX6.14/ex_6_14b.png diff --git a/62/CH6/EX6.15/ex_6_15.png b/62/CH6/EX6.15/ex_6_15.png Binary files differnew file mode 100755 index 000000000..2541ac14a --- /dev/null +++ b/62/CH6/EX6.15/ex_6_15.png diff --git a/62/CH6/EX6.15/ex_6_15.sce b/62/CH6/EX6.15/ex_6_15.sce new file mode 100755 index 000000000..d033fbc3a --- /dev/null +++ b/62/CH6/EX6.15/ex_6_15.sce @@ -0,0 +1,26 @@ +clear;
+close;
+clc;
+W=%pi/4;
+w=-10:0.1:10;
+for i=1:length(w)
+ if (w(i)>=-2*%pi-W & w(i)<=-2*%pi+W) then
+ X(i)=1;
+elseif (w(i)>=-W & w(i)<=W)
+ X(i)=1;
+elseif (w(i)>=2*%pi-W & w(i)<=2*%pi+W)
+ X(i)=1;
+else
+ X(i)=0;
+ end
+end
+figure
+subplot(2,1,1)
+plot(w,X);
+title("X[w]");
+n=-15:15;
+x=X'*exp(-%i*w'*n);
+subplot(2,1,2)
+plot2d3(n,x);
+plot(n,x,'r.')
+title("x[n] inverse fourier transform")
diff --git a/62/CH6/EX6.17/ex_6_17.png b/62/CH6/EX6.17/ex_6_17.png Binary files differnew file mode 100755 index 000000000..51e08a5e9 --- /dev/null +++ b/62/CH6/EX6.17/ex_6_17.png diff --git a/62/CH6/EX6.17/ex_6_17.sce b/62/CH6/EX6.17/ex_6_17.sce new file mode 100755 index 000000000..7e1dc069b --- /dev/null +++ b/62/CH6/EX6.17/ex_6_17.sce @@ -0,0 +1,23 @@ +clear;
+close;
+clc;
+w=-5:0.01:5;
+W0=2;
+for i=1:length(w)
+ if w(i)==W0 then
+ delta(i)=2*%pi;
+ else
+ delta(i)=0;
+ end
+end
+figure
+subplot(2,1,1)
+plot(w,delta);
+title('2*%pi*delta(w-w0)')
+//by shifting property
+n=-10:10;
+x=%e^-%i*W0*n;
+subplot(2,1,2)
+plot2d3(n,abs(x))
+plot(n,abs(x),'r.')
+title('x[n]')
\ No newline at end of file diff --git a/62/CH6/EX6.18/ex_6_18.png b/62/CH6/EX6.18/ex_6_18.png Binary files differnew file mode 100755 index 000000000..b3d8f5204 --- /dev/null +++ b/62/CH6/EX6.18/ex_6_18.png diff --git a/62/CH6/EX6.18/ex_6_18.sce b/62/CH6/EX6.18/ex_6_18.sce new file mode 100755 index 000000000..883152187 --- /dev/null +++ b/62/CH6/EX6.18/ex_6_18.sce @@ -0,0 +1,22 @@ +clear;
+close;
+clc;
+n=-10:10;
+x=ones(1,length(n));
+figure
+subplot(2,1,1)
+plot2d3(n,x)
+plot(n,x,'r.')
+xtitle('x[n]','n')
+w=-5:0.01:5;
+for i=1:length(w)
+ if w(i)==0 then
+ delta(i)=1;
+ else
+ delta(i)=0;
+ end
+end
+Xw=2*%pi*delta';
+subplot(2,1,2)
+plot(w,Xw);
+xtitle('X(w)','w')
\ No newline at end of file diff --git a/62/CH6/EX6.19/ex_6_19.png b/62/CH6/EX6.19/ex_6_19.png Binary files differnew file mode 100755 index 000000000..fc036da79 --- /dev/null +++ b/62/CH6/EX6.19/ex_6_19.png diff --git a/62/CH6/EX6.19/ex_6_19.sce b/62/CH6/EX6.19/ex_6_19.sce new file mode 100755 index 000000000..1fb830a86 --- /dev/null +++ b/62/CH6/EX6.19/ex_6_19.sce @@ -0,0 +1,26 @@ +clear;
+close;
+clc;
+n=-10:10;
+W0=1;
+x=cos(W0*n);
+figure
+subplot(2,1,1)
+plot2d3(n,x);
+title("x[n]")
+plot(n,x,'r.')
+//cos(W0*n)=1/2*(e^-%j*W0*n+e^%j*W0*n)
+w=-5:0.01:5;
+for i=1:length(w)
+ if w(i)==W0 then
+ deltaW0(i)=1;
+ else
+ deltaW0(i)=0;
+ end
+end
+delta_W0=deltaW0($:-1:1);
+//by frequency shifting property
+Xw=1/2*[deltaW0+delta_W0];
+subplot(2,1,2)
+plot2d(w,Xw);
+title("X[w] fourier transform")
diff --git a/62/CH6/EX6.22/ex_6_22.sce b/62/CH6/EX6.22/ex_6_22.sce new file mode 100755 index 000000000..726ed7db6 --- /dev/null +++ b/62/CH6/EX6.22/ex_6_22.sce @@ -0,0 +1,46 @@ +clear;
+close;
+clc;
+n=-10:10;
+N=2;
+for i=1:length(n)
+ if n(i)>=-N & n(i)<=N then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+end
+x=x';
+figure
+subplot(2,1,1)
+plot2d3(n,x);
+title("x[n]")
+plot(n,x,'r.')
+w=-10:0.1:10;
+Xw=x*exp(-%i*n'*w);
+subplot(2,1,2)
+plot2d(w,Xw);
+title("X[w] fourier transform")
+//time scaled sequence x2[n]
+n2=-20:2:20;
+figure
+subplot(2,1,1)
+plot2d3(n2,x);
+title("x2[n]")
+plot(n2,x,'r.')
+w2=-5:0.05:5;
+subplot(2,1,2)
+plot2d(w2,Xw);
+title("X2[w] fourier transform")
+//time scaled sequence x3[n]
+n3=-30:3:30;
+figure
+subplot(2,1,1)
+plot2d3(n3,x);
+title("x3[n]")
+plot(n3,x,'r.')
+w3=w/3;
+subplot(2,1,2)
+plot2d(w3,Xw);
+title("X3[w] fourier transform")
+
diff --git a/62/CH6/EX6.22/ex_6_22_1.png b/62/CH6/EX6.22/ex_6_22_1.png Binary files differnew file mode 100755 index 000000000..1f683e54a --- /dev/null +++ b/62/CH6/EX6.22/ex_6_22_1.png diff --git a/62/CH6/EX6.22/ex_6_22_2_5.png b/62/CH6/EX6.22/ex_6_22_2_5.png Binary files differnew file mode 100755 index 000000000..ddefe2d02 --- /dev/null +++ b/62/CH6/EX6.22/ex_6_22_2_5.png diff --git a/62/CH6/EX6.25/ex_6_25.png b/62/CH6/EX6.25/ex_6_25.png Binary files differnew file mode 100755 index 000000000..7bd911e36 --- /dev/null +++ b/62/CH6/EX6.25/ex_6_25.png diff --git a/62/CH6/EX6.25/ex_6_25.sce b/62/CH6/EX6.25/ex_6_25.sce new file mode 100755 index 000000000..fe8584632 --- /dev/null +++ b/62/CH6/EX6.25/ex_6_25.sce @@ -0,0 +1,14 @@ +clear;
+close;
+clc;
+a=0.7;
+n=-10:10;
+disp("X(w)=1/(1-a*e^(%i*w))^2=[1/(1-a*e^(%i*w))]*[1/(1-a*e^(%i*w))]");
+disp("we know a^n*u[n] <--> 1/(1-a*e^(%i*w)) ")
+//therefore by convolution property
+xpartial=[zeros(1,find(n==0)-1) a^n(find(n==0):$)];
+x=convol(xpartial,xpartial);
+n1=-20:20;
+plot2d3(n1,x);
+plot(n1,x,'r.');
+xtitle('x[n]','n')
\ No newline at end of file diff --git a/62/CH6/EX6.28/ex_6_28.sce b/62/CH6/EX6.28/ex_6_28.sce new file mode 100755 index 000000000..4360e6819 --- /dev/null +++ b/62/CH6/EX6.28/ex_6_28.sce @@ -0,0 +1,26 @@ +clear;
+close;
+clc;
+n=-10:10;
+x=[zeros(1,find(n==0)-1) ones(1,length(n)-find(n==0)+1)];
+plot2d3(n,x)
+plot(n,x,'r.')
+xtitle('x[n]','n')
+figure
+w=-2:2;
+Xw=x*exp(-%i*n'*w);
+subplot(2,1,1)
+plot2d(w,real(Xw));
+xtitle('U[w] fourier transform','w')
+for i=1:length(w)
+ if w(i)==0 then
+ delta(i)=1;
+ else
+ delta(i)=0;
+ end
+end
+Xwproof=%pi*delta'+ones(1,length(w))./(1-%e^(-%i*w));
+subplot(2,1,2)
+plot(w,Xwproof)
+xtitle('%pi*delta+1/(1-e^i*w','w')
+disp("it can be seen that both the figures are approximately same hence X(w)=%pi*delta+1/(1-e^i*w");
\ No newline at end of file diff --git a/62/CH6/EX6.28/ex_6_28_1.png b/62/CH6/EX6.28/ex_6_28_1.png Binary files differnew file mode 100755 index 000000000..3f151b453 --- /dev/null +++ b/62/CH6/EX6.28/ex_6_28_1.png diff --git a/62/CH6/EX6.28/ex_6_28_2.png b/62/CH6/EX6.28/ex_6_28_2.png Binary files differnew file mode 100755 index 000000000..f1bcb3553 --- /dev/null +++ b/62/CH6/EX6.28/ex_6_28_2.png diff --git a/62/CH6/EX6.3/ex_6_3.png b/62/CH6/EX6.3/ex_6_3.png Binary files differnew file mode 100755 index 000000000..ebbd81e08 --- /dev/null +++ b/62/CH6/EX6.3/ex_6_3.png diff --git a/62/CH6/EX6.3/ex_6_3.sce b/62/CH6/EX6.3/ex_6_3.sce new file mode 100755 index 000000000..878b45026 --- /dev/null +++ b/62/CH6/EX6.3/ex_6_3.sce @@ -0,0 +1,20 @@ +clear;
+close;
+clc;
+w0=2*%pi/4;//%pi/2
+N0=4;
+n=-8:7;
+y=0:3;
+x=[];
+for i=1:length(n)/4
+ x=[x y];
+end
+plot2d3(n,x');
+plot(n,x','r.')
+xtitle('x[n]','n')
+for k=0:3
+ c(k+1)=0;
+ for n=0:3
+ c(k+1)=c(k+1)+ (1/4)*(y(n+1))*(-%i)^(k*n);
+ end
+end
diff --git a/62/CH6/EX6.31/ex_6_31.png b/62/CH6/EX6.31/ex_6_31.png Binary files differnew file mode 100755 index 000000000..875f31620 --- /dev/null +++ b/62/CH6/EX6.31/ex_6_31.png diff --git a/62/CH6/EX6.31/ex_6_31.sce b/62/CH6/EX6.31/ex_6_31.sce new file mode 100755 index 000000000..182b07f70 --- /dev/null +++ b/62/CH6/EX6.31/ex_6_31.sce @@ -0,0 +1,18 @@ +clear;
+clc;
+close;
+disp("y[n]-3/4y[n-1]+1/8y[n-2]=x[n]");
+disp("taking fourier transform on both sides");
+disp("H(w)=Y(w)/X(w)=1/(1-(3/4)*e^(-j*w)+(1/8)*e^(-j*2*w))");
+w=-10:0.1:10;
+Hw=ones(1,length(w))./(1-(3/4)*%e^(-%i*w)+(1/8)*%e^(-%i*2*w));
+figure
+subplot(2,1,1)
+plot(w,Hw);
+xtitle('H(w)','w')
+n=-10:10;
+h=(1/(2*%pi))*Hw*exp(%i*w'*n);
+subplot(2,1,2)
+plot2d3(n,h)
+plot(n,h,'r.')
+xtitle('h[n]','n')
\ No newline at end of file diff --git a/62/CH6/EX6.32/ex_6_32.sce b/62/CH6/EX6.32/ex_6_32.sce new file mode 100755 index 000000000..012b1cc02 --- /dev/null +++ b/62/CH6/EX6.32/ex_6_32.sce @@ -0,0 +1,29 @@ +clear;
+clc;
+close;
+disp("y[n]-1/2*y[n-1]=x[n]+1/2*x[n-1]");
+disp("taking fourier transform on both sides");
+disp("H(w)=Y(w)/X(w)=(1+1/2*e^-j*w)/(1-1/2*e^-j*w)");
+w=-10:0.1:10;
+Hw=(1+(1/2)*%e^(-%i*w))./(1-(1/2)*%e^(-%i*w));
+figure
+subplot(2,1,1)
+plot(w,Hw);
+xtitle('H(w)','w')
+n=-10:10;
+h=(1/(2*%pi))*Hw*exp(%i*w'*n);
+subplot(2,1,2)
+plot2d3(n,h)
+xtitle('h[n]','n')
+plot(n,h,'r.')
+x=cos(%pi*n/2);
+figure
+subplot(2,1,1)
+plot2d3(n,x);
+xtitle('x[n]','n')
+plot(n,x,'r.')
+y=convol(x,h);
+subplot(2,1,2)
+plot2d3(n,y(11:31))
+xtitle('y[n]','n')
+plot(n,y(11:31),'r.')
\ No newline at end of file diff --git a/62/CH6/EX6.32/ex_6_32_1.png b/62/CH6/EX6.32/ex_6_32_1.png Binary files differnew file mode 100755 index 000000000..a5d997356 --- /dev/null +++ b/62/CH6/EX6.32/ex_6_32_1.png diff --git a/62/CH6/EX6.32/ex_6_32_2.png b/62/CH6/EX6.32/ex_6_32_2.png Binary files differnew file mode 100755 index 000000000..0f1448e21 --- /dev/null +++ b/62/CH6/EX6.32/ex_6_32_2.png diff --git a/62/CH6/EX6.33/ex_6_33.sce b/62/CH6/EX6.33/ex_6_33.sce new file mode 100755 index 000000000..f04c1649a --- /dev/null +++ b/62/CH6/EX6.33/ex_6_33.sce @@ -0,0 +1,34 @@ +clear;
+clc;
+close;
+n=-20:19;
+h=sinc(%pi*n/4)/4;
+disp("it can be seen that h[n] is a filter that allows frequencies between -%pi/4 and +%pi/4")
+disp("therefore only the dc part of x[n] is passed i.e c0")
+subplot(2,1,1)
+plot2d3(n,h);
+plot(n,h,'r.');
+xtitle('h[n]','n')
+w=-4:0.01:4;
+Hw=h*exp(-%i*n'*w);
+subplot(2,1,2)
+plot2d(w,Hw);
+title("H[w] fourier transform")
+T0=5;
+w0=%pi*2/5;
+z=[ones(1,3) zeros(1,2)];
+x=[];
+for i=1:length(n)/T0
+ x=[x z];
+end
+figure
+subplot(2,1,1)
+plot2d3(n,x);
+plot(n,x,'r.')
+xtitle('x[n]','n')
+c0= (1/5)*sum(z);
+y=ones(1,length(n))*c0;
+subplot(2,1,2)
+plot2d3(n,y);
+plot(n,y,'r.--')
+xtitle('y[n]','n')
\ No newline at end of file diff --git a/62/CH6/EX6.33/ex_6_33_1.png b/62/CH6/EX6.33/ex_6_33_1.png Binary files differnew file mode 100755 index 000000000..3690eea7b --- /dev/null +++ b/62/CH6/EX6.33/ex_6_33_1.png diff --git a/62/CH6/EX6.33/ex_6_33_2.png b/62/CH6/EX6.33/ex_6_33_2.png Binary files differnew file mode 100755 index 000000000..ba3ce0397 --- /dev/null +++ b/62/CH6/EX6.33/ex_6_33_2.png diff --git a/62/CH6/EX6.34/ex_6_34.sce b/62/CH6/EX6.34/ex_6_34.sce new file mode 100755 index 000000000..d9a77324b --- /dev/null +++ b/62/CH6/EX6.34/ex_6_34.sce @@ -0,0 +1,38 @@ +clear;
+clc;
+close;
+disp("given system is y[n]=x[n]+x[n-1]");
+disp("taking fourier transform H(w)=Y(w)/X(w)=1+e^-j*w");
+//for impulse response x[n]=delta[n]
+n=-10:10;
+for i=1:length(n)
+ if n(i)==0 then
+ delta1(i)=1;
+ delta2(i)=0;
+ elseif n(i)==1
+ delta2(i)=1;
+ delta1(i)=0
+ else
+ delta1(i)=0;
+ delta2(i)=0
+ end
+end
+h=delta1+delta2;
+plot2d3(n,h);
+plot(n,h,'r.')
+xtitle('h[n]','n')
+figure
+subplot(2,1,1)
+w=-3:0.01:3;
+Hw=1+%e^(-%i*w);
+plot(w,abs(Hw))
+xtitle('|H(w)|','w')
+subplot(2,1,2)
+a=gca();
+plot(w,phasemag(Hw)*%pi/180)
+xtitle('theta(H(w))','w')
+a.y_location="origin";
+//3-db bandwidth
+cutoff=find(round(100*abs(Hw))==round(100*max(abs(Hw))/sqrt(2)));
+threedb=w(cutoff(3));
+disp(threedb,"3db bandwidth=")
\ No newline at end of file diff --git a/62/CH6/EX6.34/ex_6_34_1.png b/62/CH6/EX6.34/ex_6_34_1.png Binary files differnew file mode 100755 index 000000000..cab499999 --- /dev/null +++ b/62/CH6/EX6.34/ex_6_34_1.png diff --git a/62/CH6/EX6.34/ex_6_34_2.png b/62/CH6/EX6.34/ex_6_34_2.png Binary files differnew file mode 100755 index 000000000..2af5cd59e --- /dev/null +++ b/62/CH6/EX6.34/ex_6_34_2.png diff --git a/62/CH6/EX6.35/ex_6_35.sce b/62/CH6/EX6.35/ex_6_35.sce new file mode 100755 index 000000000..3961a8106 --- /dev/null +++ b/62/CH6/EX6.35/ex_6_35.sce @@ -0,0 +1,22 @@ +clear;
+clc;
+close;
+disp("given system is y[n]-a*y[n-1]=x[n]");
+disp("taking fourier transform H(w)=Y(w)/X(w)=1/(1-a*e^-j*w)");
+//impulse response
+n=-10:10;
+w=-3:0.01:3;
+a=.5;
+Hw=ones(1,length(w))./(1-a*%e^(-%i*w));
+h=(1/2*%pi)*Hw*exp(%i*w'*n);
+disp("impulse response is a^n*u[n]")
+plot2d3(n,h);
+plot(n,h,'r.')
+xtitle('h[n]','n')
+figure
+plot(w,abs(Hw),'r')
+a=0.9;
+Hw=ones(1,length(w))./(1-a*%e^(-%i*w));
+plot(w,abs(Hw),'b')
+xtitle('|H(w)|','w')
+legend(['a=0.5';'a=0.9']);
\ No newline at end of file diff --git a/62/CH6/EX6.35/ex_6_35_1.png b/62/CH6/EX6.35/ex_6_35_1.png Binary files differnew file mode 100755 index 000000000..4ea9ba4a8 --- /dev/null +++ b/62/CH6/EX6.35/ex_6_35_1.png diff --git a/62/CH6/EX6.35/ex_6_35_2.png b/62/CH6/EX6.35/ex_6_35_2.png Binary files differnew file mode 100755 index 000000000..563f6791a --- /dev/null +++ b/62/CH6/EX6.35/ex_6_35_2.png diff --git a/62/CH6/EX6.36/ex_6_36.png b/62/CH6/EX6.36/ex_6_36.png Binary files differnew file mode 100755 index 000000000..33b9108a9 --- /dev/null +++ b/62/CH6/EX6.36/ex_6_36.png diff --git a/62/CH6/EX6.36/ex_6_36.sce b/62/CH6/EX6.36/ex_6_36.sce new file mode 100755 index 000000000..674a42749 --- /dev/null +++ b/62/CH6/EX6.36/ex_6_36.sce @@ -0,0 +1,29 @@ +clear;
+clc;
+close;
+wLPF=-3:0.1:3;
+wc=1;
+for i=1:length(wLPF)
+ if wLPF(i)>-wc & wLPF(i)<wc then
+ HwLPF(i)=1;
+ else
+ HwLPF(i)=0;
+ end
+end
+subplot(2,1,1)
+plot(wLPF,HwLPF)
+a=gca()
+poly1=a.children.children;
+poly1.thickness=3;
+poly1.foreground=2;
+title("low pass filter")
+disp("given h[n]=(-1)^n * hLPF[n]=e^(j*%pi*n) * hLPF[n]");
+disp("by shifting property H(w)=HLPF(w-%pi)")
+w=wLPF+%pi;
+subplot(2,1,2)
+plot(w,HwLPF)
+a=gca()
+poly1=a.children.children;
+poly1.thickness=3;
+poly1.foreground=2;
+title("high pass filter")
diff --git a/62/CH6/EX6.38/ex_6_38.png b/62/CH6/EX6.38/ex_6_38.png Binary files differnew file mode 100755 index 000000000..96cbc4c56 --- /dev/null +++ b/62/CH6/EX6.38/ex_6_38.png diff --git a/62/CH6/EX6.38/ex_6_38.sce b/62/CH6/EX6.38/ex_6_38.sce new file mode 100755 index 000000000..9fafe5998 --- /dev/null +++ b/62/CH6/EX6.38/ex_6_38.sce @@ -0,0 +1,17 @@ +clear;
+clc;
+close;
+disp("given y[n]=x[n]+x[n-1] this can be converted to high pass filter by multiplying with (-1)^n")
+disp("then y[n]=x[n]-x[n-1] taking fourier transform");
+disp("H(w)=1-e^-j*w");
+w=-3:0.01:3;
+Hw=1-%e^(-%i*w);
+subplot(2,1,1)
+plot(w,abs(Hw));
+xtitle('|H(w)|','w')
+subplot(2,1,2)
+plot(w(1:find(w==0)-1),phasemag(Hw(1:find(w==0)-1))*%pi/180)
+a=gca();
+a.y_location="origin";
+plot(w(find(w==0)+1:$),phasemag(Hw(find(w==0)+1:$))*%pi/180)
+xtitle('phase(H(w))','w')
diff --git a/62/CH6/EX6.4/ex_6_4.sce b/62/CH6/EX6.4/ex_6_4.sce new file mode 100755 index 000000000..afdcc7cff --- /dev/null +++ b/62/CH6/EX6.4/ex_6_4.sce @@ -0,0 +1,26 @@ +clear;
+close;
+clc;
+T0=10;
+w0=%pi/5;
+y=[ones(1,5) zeros(1,5)];
+n=-20:19;
+x=[];
+for i=1:length(n)/T0
+ x=[x y];
+end
+plot2d3(n,x);
+plot(n,x,'r.')
+xtitle('x[n]','n')
+for k=0:9
+ c(k+1)=0;
+ for n=0:4
+ c(k+1)=c(k+1)+ (1/4)*(y(n+1))*(%e)^(%i*w0*k*n);
+ end
+end
+c=[c($:-1:2) ;c];
+k=-9:9;
+figure
+plot2d3(k,abs(c));
+plot(k,abs(c),'r.--')
+xtitle('|ck|','k')
\ No newline at end of file diff --git a/62/CH6/EX6.4/ex_6_4_1.png b/62/CH6/EX6.4/ex_6_4_1.png Binary files differnew file mode 100755 index 000000000..b41e12415 --- /dev/null +++ b/62/CH6/EX6.4/ex_6_4_1.png diff --git a/62/CH6/EX6.4/ex_6_4_2.png b/62/CH6/EX6.4/ex_6_4_2.png Binary files differnew file mode 100755 index 000000000..77c4af945 --- /dev/null +++ b/62/CH6/EX6.4/ex_6_4_2.png diff --git a/62/CH6/EX6.40/ex_6_40.sce b/62/CH6/EX6.40/ex_6_40.sce new file mode 100755 index 000000000..d2896ce5b --- /dev/null +++ b/62/CH6/EX6.40/ex_6_40.sce @@ -0,0 +1,70 @@ +close;
+clc;
+clear;
+N=7;
+n=-4:12;
+for i=1:length(n)
+ if n(i)>=0 & n(i)<=(N-1)/2 then
+ h(i)=n(i);
+ elseif n(i)>=(N-1)/2 & n(i)<N
+ h(i)=-n(i)+(13+(-1)^N)/2;
+ else
+ h(i)=0;
+
+ end
+end
+subplot(2,1,1)
+plot2d3(n,h)
+plot(n,h,'r.')
+title("N is odd")
+N=8;
+n=-4:12;
+for i=1:length(n)
+ if n(i)>=0 & n(i)<=(N-1)/2 then
+ h(i)=n(i);
+ elseif n(i)>=(N-1)/2 & n(i)<N
+ h(i)=-n(i)+(13+(-1)^N)/2;
+ else
+ h(i)=0;
+
+ end
+end
+subplot(2,1,2)
+plot2d3(n,h)
+plot(n,h,'r.')
+title("N is even")
+disp("given h[n]=h[N-1-n] taking DFTF we get")
+disp("H(w)=H*(w) e^(-j*(N-1)*w)");
+disp("phase(w)=-1/2(N-1)*w");
+//h[n]=-h[N-1-n]
+N=7;
+n=-4:12;
+for i=1:length(n)
+ if n(i)>=0 & n(i)<N then
+ h(i)=n(i)-(N-1)/2;
+ else
+ h(i)=0;
+
+ end
+end
+figure
+subplot(2,1,1)
+plot2d3(n,h)
+plot(n,h,'r.')
+title("N is odd")
+N=8;
+n=-4:12;
+for i=1:length(n)
+ if n(i)>=0 & n(i)<N then
+ h(i)=n(i)-(N-1)/2;
+ else
+ h(i)=0;
+ end
+end
+subplot(2,1,2)
+plot2d3(n,h)
+plot(n,h,'r.')
+title("N is even")
+disp("given h[n]=-h[N-1-n] taking DFTF we get")
+disp("H(w)=-H*(w) e^(-j*(N-1)*w)");
+disp("phase(w)=%pi/2 - 1/2(N-1)*w")
\ No newline at end of file diff --git a/62/CH6/EX6.40/ex_6_40a.png b/62/CH6/EX6.40/ex_6_40a.png Binary files differnew file mode 100755 index 000000000..1b3c5a0b3 --- /dev/null +++ b/62/CH6/EX6.40/ex_6_40a.png diff --git a/62/CH6/EX6.40/ex_6_40b.png b/62/CH6/EX6.40/ex_6_40b.png Binary files differnew file mode 100755 index 000000000..133a772c6 --- /dev/null +++ b/62/CH6/EX6.40/ex_6_40b.png diff --git a/62/CH6/EX6.41/ex_6_41.sce b/62/CH6/EX6.41/ex_6_41.sce new file mode 100755 index 000000000..fa020ce0a --- /dev/null +++ b/62/CH6/EX6.41/ex_6_41.sce @@ -0,0 +1,39 @@ +close;
+clc;
+clear;
+disp("given system y[n]=1/3*{x[n]+x[n-1]+x[n-2]}");
+disp("taking h[n]=1/3*{delta[n]+delta[n-1]+delta[n-2]}")
+n=-10:10;
+for i=1:length(n)
+ if n(i)==0 then
+ delta1(i)=1;
+ delta2(i)=0;
+ delta3(i)=0;
+ elseif n(i)==1
+ delta2(i)=1;
+ delta1(i)=0;
+ delta3(i)=0;
+ elseif n(i)==2
+ delta1(i)=0;
+ delta2(i)=0;
+ delta3(i)=1;
+ else
+ delta1(i)=0;
+ delta2(i)=0;
+ delta3(i)=0;
+ end
+end
+h={delta1+delta2+delta3}/3;
+plot2d3(n,h)
+plot(n,h,'r.')
+xtitle('h[n]','n')
+disp("taking DTFT H(w)={1+e^-j*w+e^-2*j*w}/3");
+w=-3:0.1:3;
+Hw={1+%e^(-%i*w)+%e^(-2*%i*w)}/3;
+figure
+subplot(2,1,1)
+plot(w,abs(Hw));
+xtitle('|H(w)|','w')
+subplot(2,1,2)
+plot(w,phasemag(Hw)*%pi/180);
+xtitle('phase(H(w))','w')
\ No newline at end of file diff --git a/62/CH6/EX6.41/ex_6_41_1.png b/62/CH6/EX6.41/ex_6_41_1.png Binary files differnew file mode 100755 index 000000000..6d1a325d1 --- /dev/null +++ b/62/CH6/EX6.41/ex_6_41_1.png diff --git a/62/CH6/EX6.41/ex_6_41_2.png b/62/CH6/EX6.41/ex_6_41_2.png Binary files differnew file mode 100755 index 000000000..8b851d807 --- /dev/null +++ b/62/CH6/EX6.41/ex_6_41_2.png diff --git a/62/CH6/EX6.42/ex_6_42.sce b/62/CH6/EX6.42/ex_6_42.sce new file mode 100755 index 000000000..6721dda4f --- /dev/null +++ b/62/CH6/EX6.42/ex_6_42.sce @@ -0,0 +1,21 @@ +close;
+clc;
+clear;
+n=-10:10;
+h=[zeros(1,find(n==0)-1) 2 2 -2 -2 zeros(1,length(n)-find(n==0)-3)];
+plot2d3(n,h)
+plot(n,h,'r.')
+title("impulse response h[n]")
+disp("taking DTFT H(w)=sin(w/2)+sin(3*w/2)")
+w=-3:0.01:3;
+Hw=h*exp(-%i*n'*w);
+figure
+subplot(2,1,1)
+plot(w,abs(Hw)/4)
+xtitle('|H(w)|','w')
+subplot(2,1,2)
+plot(w(1:find(w==0)-1),phasemag(Hw(1:find(w==0)-1))*%pi/180)
+a=gca();
+a.y_location="origin";
+xtitle('phase(H(w))','w')
+plot(w(find(w==0)+1:$),phasemag(Hw(find(w==0)+1:$))*%pi/180)
diff --git a/62/CH6/EX6.42/ex_6_42_1.png b/62/CH6/EX6.42/ex_6_42_1.png Binary files differnew file mode 100755 index 000000000..0064b572c --- /dev/null +++ b/62/CH6/EX6.42/ex_6_42_1.png diff --git a/62/CH6/EX6.42/ex_6_42_2.png b/62/CH6/EX6.42/ex_6_42_2.png Binary files differnew file mode 100755 index 000000000..ce9a2999d --- /dev/null +++ b/62/CH6/EX6.42/ex_6_42_2.png diff --git a/62/CH6/EX6.43/ex_6_43.png b/62/CH6/EX6.43/ex_6_43.png Binary files differnew file mode 100755 index 000000000..c24c2c3a0 --- /dev/null +++ b/62/CH6/EX6.43/ex_6_43.png diff --git a/62/CH6/EX6.43/ex_6_43.sce b/62/CH6/EX6.43/ex_6_43.sce new file mode 100755 index 000000000..5b1e47bc0 --- /dev/null +++ b/62/CH6/EX6.43/ex_6_43.sce @@ -0,0 +1,29 @@ +close;
+clear;
+clc;
+disp("the system can be represented as Yc(s)=Xc(s)/(1+RCs)");
+disp("therefore Hc(s)=1/(1+RCs) hence hc(t)=e^-t*u(t) by frequency shifting property")
+disp("therefore hd[n]=hc(t)=e^(-n*Ts)*u[n]");
+disp("taking z-transform Hd(z)=1/(1-e^(-n*Ts)*z^-1)");
+Ts=1;
+w=0:0.1:15;
+Hcw=ones(1,length(w))./(1+%i*w);
+subplot(2,1,1)
+plot(w,Hcw,'r')
+//z=%e^%i*w*Ts
+title("Ts=1")
+Hdw=ones(1,length(w))./(1-exp(-Ts-%i*w*Ts));
+plot(w,Hdw,'b')
+legend(["Hc(w)";"Hd(wTs)"])
+Ts=0.1;
+w=0:0.1:15;
+Hcw=ones(1,length(w))./(1+%i*w);
+subplot(2,1,2)
+plot(w,Hcw,'r')
+//z=%e^%i*w*Ts
+title("Ts=0.1")
+Hdw=ones(1,length(w))./(1-exp(-Ts-%i*w*Ts));
+//Hdw=ones(1,length(w))./(1+%e^(-2*Ts)-2*%e^(-Ts)*cos(w*Ts))^.5;
+plot(w,Hdw,'b')
+legend(["Hc(w)";"Hd(wTs)"])
+
diff --git a/62/CH6/EX6.44/ex_6_44.sce b/62/CH6/EX6.44/ex_6_44.sce new file mode 100755 index 000000000..1ebbc0b2c --- /dev/null +++ b/62/CH6/EX6.44/ex_6_44.sce @@ -0,0 +1,7 @@ +close;
+clear;
+clc;
+disp("the system is Hc(s)=1/(s+1)*(s+2)");
+disp("therefore hc(t)=(e^-t-e^-2*t)*u(t) by frequency shifting property")
+disp("therefore hd[n]=hc(t)=(e^(-n*Ts)-e^(-2*n*Ts))*u[n]");
+disp("taking z-transform Hd(z)=1/(1-e^(-n*Ts)*z^-1) - 1/(1-e^(-2*n*Ts)*z^-1");
diff --git a/62/CH6/EX6.45/ex_6_45.png b/62/CH6/EX6.45/ex_6_45.png Binary files differnew file mode 100755 index 000000000..f5cfb749b --- /dev/null +++ b/62/CH6/EX6.45/ex_6_45.png diff --git a/62/CH6/EX6.45/ex_6_45.sce b/62/CH6/EX6.45/ex_6_45.sce new file mode 100755 index 000000000..32ee1943a --- /dev/null +++ b/62/CH6/EX6.45/ex_6_45.sce @@ -0,0 +1,13 @@ +close;
+clear;
+clc;
+disp("Hc(s)=s")
+disp(" bilinear transformation s=2*(1-z^-1)/Ts*(1+z^-1)");
+disp("Hd(z)=2*(1-z^-1)/Ts*(1+z^-1)")
+//z=e^-j*w*Ts
+w=-1:0.01:1;
+Ts=2;
+Hdw=2*(1-%e^(-%i*w*Ts))./(1+%e^(-%i*w*Ts));
+//HdwTs=2*tan(w*Ts/2)/Ts;
+plot(w*Ts,imag(Hdw));
+xtitle('Hd(w)','w')
\ No newline at end of file diff --git a/62/CH6/EX6.49/ex_6_49.sce b/62/CH6/EX6.49/ex_6_49.sce new file mode 100755 index 000000000..b77ac4ead --- /dev/null +++ b/62/CH6/EX6.49/ex_6_49.sce @@ -0,0 +1,56 @@ +close;
+clc;
+clear;
+n=0:10;
+N=8;
+for i=1:length(n)
+ if n(i)==0 then
+ delta(i)=1;
+ else
+ delta(i)=0;
+ end
+end
+x=delta';
+subplot(2,1,1)
+plot2d3(n,x);
+a=gca();
+plot(n,x,'r.')
+poly1=a.children.children;
+poly1.thickness=3;
+poly1.foreground=2;
+xtitle('x[n]','n')
+X=dft(x,-1);
+Y=X(1:find(n==N)-1);
+subplot(2,1,2)
+plot2d3(n,[Y' 0 0 0]);
+a=gca();
+plot(n,[Y' 0 0 0],'r.')
+poly1=a.children.children;
+poly1.thickness=3;
+poly1.foreground=2;
+xtitle('X[k]','k')
+for i=1:length(n)
+ if n(i)>=0 & n(i)<N then
+ x(i)=1;
+ else
+ x(i)=0;
+ end
+
+end
+figure
+subplot(2,1,1)
+plot2d3(n,x);
+plot(n,x,'r.')
+a=gca();
+poly1=a.children.children;
+poly1.thickness=3;
+poly1.foreground=2;
+xtitle('x[n]','n')
+subplot(2,1,2)
+plot2d3(n,round(dft(x,-1)));
+plot(n,round(dft(x,-1)),'r.')
+a=gca();
+poly1=a.children.children;
+poly1.thickness=3;
+poly1.foreground=2;
+xtitle('X[k]','k')
\ No newline at end of file diff --git a/62/CH6/EX6.49/ex_6_49_1.png b/62/CH6/EX6.49/ex_6_49_1.png Binary files differnew file mode 100755 index 000000000..4ae3aa4a5 --- /dev/null +++ b/62/CH6/EX6.49/ex_6_49_1.png diff --git a/62/CH6/EX6.49/ex_6_49_2.png b/62/CH6/EX6.49/ex_6_49_2.png Binary files differnew file mode 100755 index 000000000..d5f41e2c8 --- /dev/null +++ b/62/CH6/EX6.49/ex_6_49_2.png diff --git a/62/CH6/EX6.5/ex_6_5.sce b/62/CH6/EX6.5/ex_6_5.sce new file mode 100755 index 000000000..cbad048e5 --- /dev/null +++ b/62/CH6/EX6.5/ex_6_5.sce @@ -0,0 +1,25 @@ +clear;
+close;
+clc;
+T0=4;
+w0=%pi/2;
+y=[1 0 0 0];
+n=-8:7;
+x=[];
+for i=1:length(n)/T0
+ x=[x y];
+end
+plot2d3(n,x);
+plot(n,x,'r.');
+xtitle('x[n]','n')
+for k=-9:9
+ c(k+10)=0;
+ for n=0:3
+ c(k+10)=c(k+10)+ (1/4)*(y(n+1))*(%e)^(%i*w0*k*n);
+ end
+end
+k=-9:9;
+figure
+plot2d3(k,abs(c));
+plot(k,c,'r.')
+xtitle('x[n]','n')
\ No newline at end of file diff --git a/62/CH6/EX6.5/ex_6_5_1.png b/62/CH6/EX6.5/ex_6_5_1.png Binary files differnew file mode 100755 index 000000000..f61f05726 --- /dev/null +++ b/62/CH6/EX6.5/ex_6_5_1.png diff --git a/62/CH6/EX6.5/ex_6_5_2.png b/62/CH6/EX6.5/ex_6_5_2.png Binary files differnew file mode 100755 index 000000000..6cdbb79bc --- /dev/null +++ b/62/CH6/EX6.5/ex_6_5_2.png diff --git a/62/CH6/EX6.50/ex_6_50.png b/62/CH6/EX6.50/ex_6_50.png Binary files differnew file mode 100755 index 000000000..cb29ec0b2 --- /dev/null +++ b/62/CH6/EX6.50/ex_6_50.png diff --git a/62/CH6/EX6.50/ex_6_50.sce b/62/CH6/EX6.50/ex_6_50.sce new file mode 100755 index 000000000..7234437d9 --- /dev/null +++ b/62/CH6/EX6.50/ex_6_50.sce @@ -0,0 +1,53 @@ +close; +clc; +clear; +n=0:3; +x=cos(%pi*n/2); +subplot(4,1,1) +plot2d3(n,x) +xtitle('x[n]','n') +a=gca(); +a.x_location="origin"; +a.y_location="right"; +poly1=a.children.children; +poly1.thickness=3; +poly1.foreground=2; +plot(n,x,'r.') +subplot(4,1,2) +h=.5^n; +plot2d3(n,h); +xtitle('h[n]','n') +a=gca(); +a.x_location="origin"; +a.y_location="right"; +poly1=a.children.children; +poly1.thickness=3; +poly1.foreground=2; +plot(n,h,'r.') +y=convol(x,h) +subplot(4,1,3) +plot2d3(n,y(1:4)); +xtitle('y[n]','n') +plot(n,y(1:4),'r.') +a=gca(); +a.x_location="origin"; +a.y_location="right"; +poly1=a.children.children; +poly1.thickness=3; +poly1.foreground=2; +clear y; +X=dft(x,-1); +H=dft(h,-1); +Y=H.*X; +y=dft(Y,1); +subplot(4,1,4) +plot2d3(n,y); +xtitle('y[n]','n') +plot(n,y,'r.') +a=gca(); +a.x_location="origin"; +a.y_location="right"; +poly1=a.children.children; +poly1.thickness=3; +poly1.foreground=2; +plot(n,x,'r.') diff --git a/62/CH6/EX6.55/ex_6_55.sce b/62/CH6/EX6.55/ex_6_55.sce new file mode 100755 index 000000000..cd88ff496 --- /dev/null +++ b/62/CH6/EX6.55/ex_6_55.sce @@ -0,0 +1,5 @@ +x=[0 1 2 3];
+X=dft(x,-1);
+disp(X,"DFT is X(k)=")
+x=dft(X,1);
+disp(round(x),"IDFT is x[n]=")
\ No newline at end of file diff --git a/62/CH6/EX6.56/ex_6_56.png b/62/CH6/EX6.56/ex_6_56.png Binary files differnew file mode 100755 index 000000000..37057bc95 --- /dev/null +++ b/62/CH6/EX6.56/ex_6_56.png diff --git a/62/CH6/EX6.56/ex_6_56.sce b/62/CH6/EX6.56/ex_6_56.sce new file mode 100755 index 000000000..69940fb52 --- /dev/null +++ b/62/CH6/EX6.56/ex_6_56.sce @@ -0,0 +1,15 @@ +clc;
+N=4;
+n=-10:10;
+x=[zeros(1,find(n==0)-1) rand(1,-find(n==0)+find(n==N)+1) zeros(1,length(n)-find(n==N))];
+plot2d3(n,x)
+nf=-5:0.5:5;
+figure
+subplot(2,1,1)
+plot2d3(ceil(nf),x);
+xtitle('f[n]','n')
+subplot(2,1,2)
+ng=nf-1/2;
+plot2d3(ceil(ng),x);
+xtitle('g[n]','n')
+disp("from the graphs it is visible that f[n]=g[n]=0 outside 0<=n<=N/2-1");
\ No newline at end of file diff --git a/62/CH6/EX6.57/ex_6_57.sce b/62/CH6/EX6.57/ex_6_57.sce new file mode 100755 index 000000000..631926af2 --- /dev/null +++ b/62/CH6/EX6.57/ex_6_57.sce @@ -0,0 +1,23 @@ +clear;
+close;
+clc;
+x=[1 1 -1 -1 -1 1 1 -1];
+N=8;
+n=0:7;
+k=0:N/2-1;
+WkN=exp(-%i*2*%pi*k/N);
+f=[];
+g=[];
+for i=1:length(n)
+ if modulo(n(i),2)==0 then
+ f=[f x(i)];
+ else
+ g=[g x(i)];
+ end
+end
+Fk=dft(f,-1);
+Gk=dft(g,-1);
+//Xk=Fk-WkN*Gk
+Xk=Fk-WkN'.*Gk;
+Xk=[Xk; Xk];
+disp(round(Xk))
diff --git a/62/CH6/EX6.59/ex_6_59.sce b/62/CH6/EX6.59/ex_6_59.sce new file mode 100755 index 000000000..f1f73129c --- /dev/null +++ b/62/CH6/EX6.59/ex_6_59.sce @@ -0,0 +1,22 @@ +clear;
+close;
+clc;
+x=[1 1 -1 -1 -1 1 1 -1];
+N=8;
+n=0:7;
+p=x(1:4)+x(5:8);
+k=0:N/2-1;
+WkN=exp(-%i*2*%pi*k/N);
+q=[x(1:4)-x(5:8)].*WkN;
+Pk=dft(p,-1);
+Qk=dft(q,-1);
+//X[2k]=P[k] X[2k+1]=Q[k]
+for i=1:length(k)
+ if modulo(i,2)==0 then
+ Xk(i)=Qk(i/2);
+ else
+ Xk(i)=Pk(ceil((i)/2));
+ end
+end
+Xk=[Xk;Xk];
+disp(round(Xk));
\ No newline at end of file diff --git a/62/CH6/EX6.6/ex_6_6.sce b/62/CH6/EX6.6/ex_6_6.sce new file mode 100755 index 000000000..0285fc591 --- /dev/null +++ b/62/CH6/EX6.6/ex_6_6.sce @@ -0,0 +1,67 @@ +clear;
+close;
+clc;
+//cos(%pi*n/4)
+N0=8;
+w0=2*%pi/N0;
+n=-8:8;
+x=cos(%pi*n/4);
+subplot(2,1,1)
+xtitle('x[n]','n')
+plot2d3(n,x);
+plot(n,x,'r.');
+for k=-6:6
+ c(k+7)=0;
+ for n=0:7
+ c(k+7)=c(k+7)+ (1/8)*(x(n+1))*(%e)^(%i*w0*k*n);
+ end
+end
+k=-6:6;
+subplot(2,1,2)
+xtitle('|ck|','k')
+plot2d3(k,abs(c));
+plot(k,c,'r.')
+//cos(%pi*n/3)+sin(%pi*n/4)
+N0=24;
+w0=2*%pi/N0;
+n=-24:24;
+x=cos(%pi*n/3)+sin(%pi*n/4);
+figure
+subplot(2,1,1)
+xtitle('x[n]','n')
+plot2d3(n,x);
+plot(n,x,'r.--');
+for k=-24:24
+ c(k+25)=0;
+ for n=0:23
+ c(k+25)=c(k+25)+ (1/N0)*(x(n+1))*(%e)^(%i*w0*k*n);
+ end
+end
+k=-24:24;
+subplot(2,1,2)
+xtitle('|ck|','k')
+plot2d3(k,abs(c));
+plot(k,c,'r.')
+//[cos(%pi*n/8)]^2
+N0=8;
+w0=2*%pi/N0;
+n=-8:8;
+x=[cos(%pi*n/8)]^2;
+clear c;
+figure
+subplot(2,1,1)
+xtitle('x[n]','n')
+plot2d3(n,x);
+plot(n,x,'r.--');
+for k=-6:6
+ c(k+7)=0;
+ for n=0:7
+ c(k+7)=c(k+7)+ (1/N0)*(x(n+1))*(%e)^(%i*w0*k*n);
+ end
+end
+k=-6:6;
+subplot(2,1,2)
+xtitle('|ck|','k')
+plot2d3(k,abs(c));
+plot(k,c,'r.')
+disp("fourier series is x[n]=1/N0*sum(c(k)*e^%i*w0*n*k)");
\ No newline at end of file diff --git a/62/CH6/EX6.6/ex_6_6_2.png b/62/CH6/EX6.6/ex_6_6_2.png Binary files differnew file mode 100755 index 000000000..ebc3215ef --- /dev/null +++ b/62/CH6/EX6.6/ex_6_6_2.png diff --git a/62/CH6/EX6.6/ex_6_6a.png b/62/CH6/EX6.6/ex_6_6a.png Binary files differnew file mode 100755 index 000000000..d1b78c4cc --- /dev/null +++ b/62/CH6/EX6.6/ex_6_6a.png diff --git a/62/CH6/EX6.61/ex_6_61.sce b/62/CH6/EX6.61/ex_6_61.sce new file mode 100755 index 000000000..bc676c873 --- /dev/null +++ b/62/CH6/EX6.61/ex_6_61.sce @@ -0,0 +1,18 @@ +clear;
+close;
+clc;
+T1=10;
+wM=100;
+N=ceil(wM*T1/%pi);
+dw=2*wM/N;
+dt=%pi/wM;
+WN=exp(-%i*2*%pi/N);
+n=0:N-1;
+x=%e^-(n*dt);
+k=0:10;
+Xk=dt*x*exp(-%i*2*%pi*n'*k/N);
+disp(Xk(find(k==0)),Xk(find(k==1)),Xk(find(k==10)),"X[0] X[1] X[10] from X[k]")
+w=0:dw:10*dw;
+Xw=ones(1,length(w))./(%i*w+1);
+disp(Xw(find(w==0)),Xw(find(w==dw)),Xw(find(w==10*dw)),"X(0) X(dw) X(10*dw) from X(w)")
+disp("it can be seen that X[k] gives a good approximation to X(w)")
\ No newline at end of file |