summaryrefslogtreecommitdiff
path: root/2279/CH5
diff options
context:
space:
mode:
authorprashantsinalkar2017-10-10 12:27:19 +0530
committerprashantsinalkar2017-10-10 12:27:19 +0530
commit7f60ea012dd2524dae921a2a35adbf7ef21f2bb6 (patch)
treedbb9e3ddb5fc829e7c5c7e6be99b2c4ba356132c /2279/CH5
parentb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (diff)
downloadScilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.gz
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.tar.bz2
Scilab-TBC-Uploads-7f60ea012dd2524dae921a2a35adbf7ef21f2bb6.zip
initial commit / add all books
Diffstat (limited to '2279/CH5')
-rw-r--r--2279/CH5/EX5.1/Ex5_1.sce56
-rw-r--r--2279/CH5/EX5.14/Ex5_14.sce37
-rw-r--r--2279/CH5/EX5.15/Ex5_15.sce37
-rw-r--r--2279/CH5/EX5.16/Ex5_16.sce27
-rw-r--r--2279/CH5/EX5.17/Ex5_17.sce29
-rw-r--r--2279/CH5/EX5.18/Ex5_18.sce22
-rw-r--r--2279/CH5/EX5.19/Ex5_19.sce29
-rw-r--r--2279/CH5/EX5.2/Ex5_2.sce43
-rw-r--r--2279/CH5/EX5.20/Ex5_20.sce28
-rw-r--r--2279/CH5/EX5.21/Ex5_21.sce26
-rw-r--r--2279/CH5/EX5.22/Ex5_22.sce26
-rw-r--r--2279/CH5/EX5.24/Ex5_24.sce14
-rw-r--r--2279/CH5/EX5.25/Ex5_25.sce16
-rw-r--r--2279/CH5/EX5.3/Ex5_3.sce34
-rw-r--r--2279/CH5/EX5.32/Ex5_32.sce21
-rw-r--r--2279/CH5/EX5.37/Ex5_37.sce37
-rw-r--r--2279/CH5/EX5.4/Ex5_4.sce35
-rw-r--r--2279/CH5/EX5.5/Ex5_5.sce41
-rw-r--r--2279/CH5/EX5.6/Ex5_6.sce21
-rw-r--r--2279/CH5/EX5.7/Ex5_7.sce50
-rw-r--r--2279/CH5/EX5.8/Ex5_8.sce23
21 files changed, 652 insertions, 0 deletions
diff --git a/2279/CH5/EX5.1/Ex5_1.sce b/2279/CH5/EX5.1/Ex5_1.sce
new file mode 100644
index 000000000..cd9426dd7
--- /dev/null
+++ b/2279/CH5/EX5.1/Ex5_1.sce
@@ -0,0 +1,56 @@
+
+
+
+
+
+//Continuous Time Fourier Series Coefficients of
+//a periodic signal x(t) = sin(2*Wot)
+clear;
+close;
+clc;
+t = 0:0.01:1;
+T = 1;
+Wo = 2*%pi/T;
+xt = sin(2*Wo*t);
+for k =0:4
+ C(k+1,:) = exp(-sqrt(-1)*Wo*t.*k);
+ a(k+1) = xt*C(k+1,:)'/length(t);
+ if(abs(a(k+1))<=0.01)
+ a(k+1)=0;
+ end
+end
+a =a';
+ak = [-a,a(2:$)]
+for i=1:length(ak)
+ if real(ak(i))== 0 then
+ phase(i)=0;
+ else
+ if i<length(ak)/2 then
+ phase(i)= atan(imag(ak(i))/real(ak(i)));
+ else
+ phase(i)= -atan(imag(ak(i))/real(ak(i)));
+ end
+ end
+end
+disp("The fourier series coefficients are...")
+disp(ak)
+disp("magnitude of Fourier series coefficient")
+disp(abs(ak))
+disp("Phase of Fourier series coefficient in radians")
+disp(phase)
+n=-4:4;
+subplot(2,1,1)
+plot(n,abs(ak),'.');
+xtitle("|ak|","k","|ak|");
+subplot(2,1,2)
+for i=1:length(n)
+ if n(i)== -2 then
+ phase(i)=3.14/2;
+ elseif n(i)== 2 then
+ phase(i)= -3.14/2;
+ else
+ phase(i)=0;
+end
+end
+plot(n,phase,'.');
+xtitle("/_ak","k","/_ak");
diff --git a/2279/CH5/EX5.14/Ex5_14.sce b/2279/CH5/EX5.14/Ex5_14.sce
new file mode 100644
index 000000000..7aafaad98
--- /dev/null
+++ b/2279/CH5/EX5.14/Ex5_14.sce
@@ -0,0 +1,37 @@
+//Continuous Time Signal x(t)= exp(-B*t)u(t), t>0
+clear;
+clc;
+close;
+B =1;
+Dt = 0.005;
+t = 0:Dt:10;
+xt = exp(-B*t);
+Wmax = 2*%pi*1;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+XW = xt* exp(-sqrt(-1)*t'*W) * Dt;
+XW_Mag = abs(XW);
+W = [-mtlb_fliplr(W), W(2:1001)];
+XW_Mag = [mtlb_fliplr(XW_Mag), XW_Mag(2:1001)];
+[XW_Phase,db] = phasemag(XW);
+XW_Phase = [-mtlb_fliplr(XW_Phase),XW_Phase(2:1001)];
+//Plotting Continuous Time Signal
+figure(1)
+plot(t,xt);
+xlabel('t in sec.');
+ylabel('x(t)')
+title('Continuous Time Signal')
+figure(2)
+//Plotting Magnitude Response of CTS
+subplot(2,1,1);
+plot(W,XW_Mag);
+xlabel('Frequency in Radians/Seconds---> W');
+ylabel('abs(X(jW))')
+title('Magnitude Response (CTFT)')
+//Plotting Phase Reponse of CTS
+subplot(2,1,2);
+plot(W,XW_Phase*%pi/180);
+xlabel(' Frequency in Radians/Seconds---> W');
+ylabel(' <X(jW)')
+title('Phase Response(CTFT) in Radians')
diff --git a/2279/CH5/EX5.15/Ex5_15.sce b/2279/CH5/EX5.15/Ex5_15.sce
new file mode 100644
index 000000000..fc0495da8
--- /dev/null
+++ b/2279/CH5/EX5.15/Ex5_15.sce
@@ -0,0 +1,37 @@
+//Continuous Time Signal x(t)= exp(B*t)u(-t), t>0
+clear;
+clc;
+close;
+B =1;
+Dt = 0.005;
+t = -10:Dt:0;
+xt = exp(B*t);
+Wmax = 2*%pi*1;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+XW = xt* exp(-sqrt(-1)*t'*W) * Dt;
+XW_Mag = abs(XW);
+W = [-mtlb_fliplr(W), W(2:1001)];
+XW_Mag = [mtlb_fliplr(XW_Mag), XW_Mag(2:1001)];
+[XW_Phase,db] = phasemag(XW);
+XW_Phase = [-mtlb_fliplr(XW_Phase),XW_Phase(2:1001)];
+//Plotting Continuous Time Signal
+figure(1)
+plot(t,xt);
+xlabel('t in sec.');
+ylabel('x(t)')
+title('Continuous Time Signal')
+figure(2)
+//Plotting Magnitude Response of CTS
+subplot(2,1,1);
+plot(W,XW_Mag);
+xlabel('Frequency in Radians/Seconds---> W');
+ylabel('abs(X(jW))')
+title('Magnitude Response (CTFT)')
+//Plotting Phase Reponse of CTS
+subplot(2,1,2);
+plot(W,XW_Phase*%pi/180);
+xlabel(' Frequency in Radians/Seconds---> W');
+ylabel(' <X(jW)')
+title('Phase Response(CTFT) in Radians')
diff --git a/2279/CH5/EX5.16/Ex5_16.sce b/2279/CH5/EX5.16/Ex5_16.sce
new file mode 100644
index 000000000..39c8f4688
--- /dev/null
+++ b/2279/CH5/EX5.16/Ex5_16.sce
@@ -0,0 +1,27 @@
+//Continuous Time Signal x(t)= exp(-B*abs(t))
+clear;
+clc;
+close;
+B =1;
+Dt = 0.005;
+t = -4.5:Dt:4.5;
+xt = exp(-B*abs(t));
+Wmax = 2*%pi*1;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+XW = xt* exp(-sqrt(-1)*t'*W) * Dt;
+XW = real(XW);
+W = [-mtlb_fliplr(W), W(2:1001)];
+XW = [mtlb_fliplr(XW), XW(2:1001)];
+disp("The given signal is even and it has no phase spectrum")
+subplot(2,1,1);
+plot(t,xt);
+xlabel('t in sec.');
+ylabel('x(t)')
+title('Continuous Time Signal')
+subplot(2,1,2);
+plot(W,XW);
+xlabel('Frequency in Radians/Seconds W');
+ylabel('X(jW)')
+title('Continuous-time Fourier Transform')
diff --git a/2279/CH5/EX5.17/Ex5_17.sce b/2279/CH5/EX5.17/Ex5_17.sce
new file mode 100644
index 000000000..7b7d4a03f
--- /dev/null
+++ b/2279/CH5/EX5.17/Ex5_17.sce
@@ -0,0 +1,29 @@
+//Frequency Response of a Rectangular Waveform
+// x(t)= A, from -T1 to T1
+clear;
+clc;
+close;
+A =1;
+Dt = 0.005;
+T1 = 4;
+t = -T1/2:Dt:T1/2;
+for i = 1:length(t)
+ xt(i) = A;
+end
+Wmax = 2*%pi*1;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+xt = xt';
+XW = xt* exp(-sqrt(-1)*t'*W) * Dt;
+XW_Mag = real(XW);
+W = [-mtlb_fliplr(W), W(2:1001)];
+XW_Mag = [mtlb_fliplr(XW_Mag), XW_Mag(2:1001)];
+subplot(2,1,1);
+plot(t,xt);
+xlabel('t in sec.');
+title('Contiuous Time Signal x(t)')
+subplot(2,1,2);
+plot(W,XW_Mag);
+xlabel('Frequency in Radians/Seconds');
+title('Continuous-time Fourier Transform X(jW)')
diff --git a/2279/CH5/EX5.18/Ex5_18.sce b/2279/CH5/EX5.18/Ex5_18.sce
new file mode 100644
index 000000000..b57e4044c
--- /dev/null
+++ b/2279/CH5/EX5.18/Ex5_18.sce
@@ -0,0 +1,22 @@
+// Inverse Continuous Time Fourier Transform
+// X(jW)= 1, from -T1 to T1
+clear;
+clc;
+close;
+// CTFT
+A =1;
+Dw = 0.005;
+W1 = 4;
+w = -W1/2:Dw:W1/2;
+for i = 1:length(w)
+ XW(i) = A;
+end
+XW = XW';
+//Inverse Continuous-time Fourier Transform
+t = -3*%pi:%pi/length(w):3*%pi;
+xt =(1/(2*%pi))*XW *exp(sqrt(-1)*w'*t)*Dw;
+xt = real(xt);
+figure
+plot(t,xt);
+xlabel(' t Sec');
+title('Time domain signal x(t)')
diff --git a/2279/CH5/EX5.19/Ex5_19.sce b/2279/CH5/EX5.19/Ex5_19.sce
new file mode 100644
index 000000000..f61779753
--- /dev/null
+++ b/2279/CH5/EX5.19/Ex5_19.sce
@@ -0,0 +1,29 @@
+//frequency response of impulse signal
+clear;
+clc;
+close;
+A =1;
+Dt = 0.005;
+T1 = 4;
+Wo=2//Assume Wo=2
+t = -T1/2:Dt:T1/2;
+for i = 1:length(t)
+ xt(i)=sin(Wo*t(i));
+end
+Wmax = 2*%pi*1;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+xt = xt';
+XW = xt* exp(-sqrt(-1)*t'*W) * Dt;
+XW_Mag = real(XW);
+W = [-mtlb_fliplr(W), W(2:1001)];
+XW_Mag = [mtlb_fliplr(XW_Mag), XW_Mag(2:1001)];
+subplot(2,1,1);
+plot(t,xt);
+xlabel('t in sec.');
+title('Contiuous Time Signal x(t)')
+subplot(2,1,2);
+plot(W,XW_Mag);
+xlabel('Frequency in Radians/Seconds');
+title('Continuous-time Fourier Transform X(jW)')
diff --git a/2279/CH5/EX5.2/Ex5_2.sce b/2279/CH5/EX5.2/Ex5_2.sce
new file mode 100644
index 000000000..f88b3868e
--- /dev/null
+++ b/2279/CH5/EX5.2/Ex5_2.sce
@@ -0,0 +1,43 @@
+//Continuous Time Fourier Series Coefficients of
+//a periodic signal x(t) = cos(Wot)
+clear;
+close;
+clc;
+t = 0:0.01:1;
+T = 1;
+Wo = 2*%pi/T;
+xt = cos(Wo*t);
+x1t=cos(Wo*-t);
+for k =0:2
+ C(k+1,:) = exp(-sqrt(-1)*Wo*t.*k);
+ a(k+1) = xt*C(k+1,:)'/length(t);
+ if(abs(a(k+1))<=0.01)
+ a(k+1)=0;
+ end
+end
+a =a';
+ak = [-a,a(2:$)]
+disp("The fourier series coefficients are...")
+disp(ak)
+disp("magnitude of Fourier series coefficient")
+disp(abs(ak))
+n=-2:2;
+subplot(2,1,1)
+plot(n,abs(ak),'.');
+xtitle("Magnitude Spectrum","k","|ak|");
+if xt== x1t then
+ disp("The Given signal is even. It has no phase spectrum");
+else
+for i=1:length(ak)
+ if real(ak(i))== 0 then
+ phase(i)=0;
+ else
+ phase(i)=atan(imag(ak(i))/real(ak(i)));
+ end
+end
+disp("Phase of Fourier series coefficient in radians")
+disp(phase)
+subplot(2,1,2)
+plot(n,phase,'.');
+xtitle("Phase Spectrum","k","ak in radians");
+end
diff --git a/2279/CH5/EX5.20/Ex5_20.sce b/2279/CH5/EX5.20/Ex5_20.sce
new file mode 100644
index 000000000..fc26d738c
--- /dev/null
+++ b/2279/CH5/EX5.20/Ex5_20.sce
@@ -0,0 +1,28 @@
+// Inverse Continuous Time Fourier Transform
+// X(jW)= 2*pi, at W=0
+clear;
+clc;
+close;
+// CTFT
+A =1;
+Dw = 0.005;
+W1 = 4;
+w = -W1/2:Dw:W1/2;
+for i = 1:length(w)
+ if w(i)==0 then
+ XW(i) = 2*%pi;
+else
+ XW(i)=0;
+end
+end
+XW = XW';
+subplot(2,1,1)
+plot(w,XW)
+//Inverse Continuous-time Fourier Transform
+t = -3*%pi:%pi/length(w):3*%pi;
+xt =(1/(2*%pi))*XW *exp(sqrt(-1)*w'*t)*Dw;
+xt = real(1+xt);
+subplot(2,1,2)
+plot(t,xt);
+xlabel(' t Sec');
+title('Time domain signal x(t)')
diff --git a/2279/CH5/EX5.21/Ex5_21.sce b/2279/CH5/EX5.21/Ex5_21.sce
new file mode 100644
index 000000000..f50d54b18
--- /dev/null
+++ b/2279/CH5/EX5.21/Ex5_21.sce
@@ -0,0 +1,26 @@
+// Inverse Continuous Time Fourier Transform
+// X(jW)= 2*pi, at W=Wo
+clear;
+clc;
+close;
+// CTFT
+A =1;
+Dw = 0.005;
+W1 = 4;
+Wo=2//Assume Wo=2
+w = -W1/2:Dw:W1/2;
+for i = 1:length(w)
+ if w(i)==Wo then
+ XW(i) = 2*%pi;
+else
+ XW(i)=0;
+end
+end
+XW = XW';
+//Inverse Continuous-time Fourier Transform
+t = -3*%pi:%pi/length(w):3*%pi;
+xt =(1/(2*%pi))*XW *exp(sqrt(-1)*w'*t)*Dw;
+xt = real(1+xt);
+plot(t,xt);
+xlabel(' t Sec');
+title('Time domain signal x(t)')
diff --git a/2279/CH5/EX5.22/Ex5_22.sce b/2279/CH5/EX5.22/Ex5_22.sce
new file mode 100644
index 000000000..af89d94f6
--- /dev/null
+++ b/2279/CH5/EX5.22/Ex5_22.sce
@@ -0,0 +1,26 @@
+// Inverse Continuous Time Fourier Transform
+// X(jW)= 2*pi, at W=-Wo
+clear;
+clc;
+close;
+// CTFT
+A =1;
+Dw = 0.005;
+W1 = 4;
+Wo=2//Assume Wo=2
+w = -W1/2:Dw:W1/2;
+for i = 1:length(w)
+ if w(i)==-Wo then
+ XW(i) = 2*%pi;
+else
+ XW(i)=0;
+end
+end
+XW = XW';
+//Inverse Continuous-time Fourier Transform
+t = -3*%pi:%pi/length(w):3*%pi;
+xt =(1/(2*%pi))*XW *exp(sqrt(-1)*w'*t)*Dw;
+xt = real(1+xt);
+plot(t,xt);
+xlabel(' t Sec');
+title('Time domain signal x(t)')
diff --git a/2279/CH5/EX5.24/Ex5_24.sce b/2279/CH5/EX5.24/Ex5_24.sce
new file mode 100644
index 000000000..cf324aad2
--- /dev/null
+++ b/2279/CH5/EX5.24/Ex5_24.sce
@@ -0,0 +1,14 @@
+// Continuous Time Fourier Transforms of
+// Sinusoidal waveforms sin(Wot)
+clear
+clc;
+close;
+T1 = 2;
+T = 4*T1;
+Wo = 2*%pi/T;
+W = [-Wo,0,Wo];
+ak = (2*%pi*Wo*T1/%pi)/sqrt(-1);
+XW = [-ak,0,ak];
+plot(W,-imag(XW),'.');
+xlabel(' W');
+xtitle('CTFT of sin(Wot)','W','X(jW)')
diff --git a/2279/CH5/EX5.25/Ex5_25.sce b/2279/CH5/EX5.25/Ex5_25.sce
new file mode 100644
index 000000000..350ed7339
--- /dev/null
+++ b/2279/CH5/EX5.25/Ex5_25.sce
@@ -0,0 +1,16 @@
+// Continuous Time Fourier Transforms of
+// Sinusoidal waveforms cos(Wot)
+clear;
+clc;
+close;
+// CTFT
+T1 = 2;
+T = 4*T1;
+Wo = 2*%pi/T;
+W = [-Wo,0,Wo];
+ak = (2*%pi*Wo*T1/%pi);
+XW =[ak,0,ak];
+plot(W,abs(XW),'.');
+xlabel(' W');
+xtitle('CTFT of cos(Wot)','W','X(jW)')
+
diff --git a/2279/CH5/EX5.3/Ex5_3.sce b/2279/CH5/EX5.3/Ex5_3.sce
new file mode 100644
index 000000000..f3de06d08
--- /dev/null
+++ b/2279/CH5/EX5.3/Ex5_3.sce
@@ -0,0 +1,34 @@
+//Continuous Time Fourier Series Coefficients of
+//a periodic signal x(t) = 5*cos((%pi/2*t)+(%pi/6))
+clear;
+close;
+clc;
+t = 0:0.01:1;
+T = 1;
+Wo = 2*%pi/T;
+xt = cos((%pi/2*t)+(%pi/6))
+x1t=cos((%pi/2*-t)+(%pi/6))
+
+//x(t) is expanded according to Euler's theorem
+x=5/2*(exp(%i*(%pi/2*t+%pi/6))+exp(-%i*(%pi/2*t+%pi/6)));
+a1=5/2*exp(%i*%pi/6);
+a_1=5/2*exp(-%i*%pi/6);
+ak=[zeros(1,5) a_1 0 a1 zeros(1,5)];
+k=-6:6;
+disp("The fourier series coefficients are...")
+disp(ak)
+disp("magnitude of Fourier series coefficient")
+disp(abs(ak))
+subplot(2,1,1)
+plot(k,abs(ak),'.');
+xtitle("Magnitude Spectrum","k","|ak|");
+if xt== x1t then
+ disp("The Given signal is even. It has no phase spectrum");
+else
+ phase=[zeros(1,5) atan(imag(a_1)/real(a_1)) 0 atan(imag(a1)/real(a1)) zeros(1,5)];
+ disp("Phase of Fourier series coefficient in radians")
+ disp(phase)
+ subplot(2,1,2)
+ plot(k,phase,'.');
+ xtitle("Phase Spectrum","k","ak in radians");
+end
diff --git a/2279/CH5/EX5.32/Ex5_32.sce b/2279/CH5/EX5.32/Ex5_32.sce
new file mode 100644
index 000000000..43cb6362a
--- /dev/null
+++ b/2279/CH5/EX5.32/Ex5_32.sce
@@ -0,0 +1,21 @@
+//CTFT of Periodic Impulse Train
+clear;
+clc;
+close;
+// CTFT
+T = -4:4;;
+T1 = 1;
+xt = ones(1,length(T));
+ak = 1/T1;
+XW = 2*%pi*ak*ones(1,length(T));
+Wo = 2*%pi/T1;
+W = Wo*T;
+figure
+subplot(2,1,1)
+plot2d3('gnn',T,xt);
+xlabel(' t');
+title('Periodic Impulse Train')
+subplot(2,1,2)
+plot2d3('gnn',W,XW);
+xlabel(' t');
+title('CTFT of Periodic Impulse Train')
diff --git a/2279/CH5/EX5.37/Ex5_37.sce b/2279/CH5/EX5.37/Ex5_37.sce
new file mode 100644
index 000000000..bc805dab7
--- /dev/null
+++ b/2279/CH5/EX5.37/Ex5_37.sce
@@ -0,0 +1,37 @@
+//Continuous Time Signal x(t)= 0.5*exp(-B*t*0.5)u(t), t>0
+clear;
+clc;
+close;
+B =1;
+Dt = 0.005;
+t = 0:Dt:10;
+h = 0.5*exp(-B*t*0.5);
+Wmax = 2*%pi*1;
+K = 4;
+k = 0:(K/1000):K;
+W = k*Wmax/K;
+XW = h* exp(-sqrt(-1)*t'*W) * Dt;
+XW_Mag = abs(XW);
+W = [-mtlb_fliplr(W), W(2:1001)];
+XW_Mag = [mtlb_fliplr(XW_Mag), XW_Mag(2:1001)];
+[XW_Phase,db] = phasemag(XW);
+XW_Phase = [-mtlb_fliplr(XW_Phase),XW_Phase(2:1001)];
+//Plotting Continuous Time Signal
+figure(1)
+plot(t,h);
+xlabel('t in sec.');
+ylabel('x(t)')
+title('Continuous Time Signal')
+figure(2)
+//Plotting Magnitude Response of CTS
+subplot(2,1,1);
+plot(W,XW_Mag);
+xlabel('Frequency in Radians/Seconds---> W');
+ylabel('abs(X(jW))')
+title('Magnitude Response (CTFT)')
+//Plotting Phase Reponse of CTS
+subplot(2,1,2);
+plot(W,XW_Phase*%pi/180);
+xlabel(' Frequency in Radians/Seconds---> W');
+ylabel(' <X(jW)')
+title('Phase Response(CTFT) in Radians')
diff --git a/2279/CH5/EX5.4/Ex5_4.sce b/2279/CH5/EX5.4/Ex5_4.sce
new file mode 100644
index 000000000..ee824c03f
--- /dev/null
+++ b/2279/CH5/EX5.4/Ex5_4.sce
@@ -0,0 +1,35 @@
+//Continuous Time Fourier Series Coefficients of
+//a periodic signal x(t) = 1+sin(6t)+cos(4t)
+clear;
+close;
+clc;
+t = 0:0.01:1;
+xt = 1+sin(6*t)+cos(4*t);
+x_t = 1+sin(6*-t)+cos(4*-t);
+
+//x(t) is expanded according to Euler's theorem
+x=1+(1/2)*exp(%i*4*t)+(1/2)*exp(-%i*4*t)+(1/(2*%i))*exp(%i*6*t)-(1/(2*%i))*exp(-%i*6*t);
+a0=1;
+a2=(1/2)
+a_2=(1/2)
+a3=(1/(2*%i));
+a_3=-(1/(2*%i));
+ak=[zeros(1,5) a_3 a_2 0 a2 a3 zeros(1,5)];
+k=-7:7;
+disp("The fourier series coefficients are...")
+disp(ak)
+disp("magnitude of Fourier series coefficient")
+disp(abs(ak))
+subplot(2,1,1)
+plot(k,abs(ak),'.');
+xtitle("Magnitude Spectrum","k","|ak|");
+if xt== x_t then
+ disp("The Given signal is even. It has no phase spectrum");
+else
+ phase=[zeros(1,6) %pi/2 0 -%pi/2 zeros(1,6)];
+ disp("Phase of Fourier series coefficient in radians")
+ disp(phase)
+ subplot(2,1,2)
+ plot(k,phase,'.');
+ xtitle("Phase Spectrum","k","ak in radians");
+end
diff --git a/2279/CH5/EX5.5/Ex5_5.sce b/2279/CH5/EX5.5/Ex5_5.sce
new file mode 100644
index 000000000..5f93e2cfb
--- /dev/null
+++ b/2279/CH5/EX5.5/Ex5_5.sce
@@ -0,0 +1,41 @@
+//Fourier Series coefficients of the signal x(t)
+//Assume the period of the signal T=10
+clc
+clear
+close
+T=1;
+To=1/4;
+//Assume the magnitude of the signal A=1
+A=1;
+t=-10:0.01:10;
+for i=1:length(t)
+ if t>To & t<-To then
+ x(i)=0;
+ else
+ x(i)=A;
+ end
+end
+
+Wo=2*%pi;
+
+k=-5:5
+for i=1:length(k)
+ if k(i)==0 then
+ ak(i)=1.5;
+ else
+ ak(i)=(sin(k(i)*%pi/2))/(k(i)*%pi);
+ end
+end
+
+disp("The fourier series coefficients are...")
+disp(ak)
+disp("magnitude of Fourier series coefficient")
+disp(abs(ak))
+disp("the givem signal is even and so it has no phase spectrum")
+//PLotting frequency spectrum
+subplot(2,1,2)
+plot(k,abs(ak),'.');
+xtitle("Magnitude Spectrum","k","|ak|");
+subplot(2,1,1)
+plot(k,ak,'.');
+xtitle("Ak","k","ak");
diff --git a/2279/CH5/EX5.6/Ex5_6.sce b/2279/CH5/EX5.6/Ex5_6.sce
new file mode 100644
index 000000000..a08627cd1
--- /dev/null
+++ b/2279/CH5/EX5.6/Ex5_6.sce
@@ -0,0 +1,21 @@
+//Fourier Series coefficients for Impulse train
+clc
+clear
+close
+//Assume period of the impulse train T=2
+T=2;
+t=-5*T:T:5*T;
+for i=1:length(t)
+ x(i)=1;
+end
+//Using sifting property of the impulse signal
+k=-10:10
+for i=1:length(k)
+ ak(i)=1/T;
+end
+subplot(2,1,1)
+plot(t,x,'.')
+xtitle("Impulse train","t","x(t)")
+subplot(2,1,2)
+plot(k,ak,'.')
+xtitle("Fourier coefficients of impulse train","k","ak")
diff --git a/2279/CH5/EX5.7/Ex5_7.sce b/2279/CH5/EX5.7/Ex5_7.sce
new file mode 100644
index 000000000..b1a9f8517
--- /dev/null
+++ b/2279/CH5/EX5.7/Ex5_7.sce
@@ -0,0 +1,50 @@
+//Fourier Series coefficients of half-wave rectifier output
+//Assume the period of the signal T=1
+t=-0.5:0.01:1;
+T = 1;
+for i=1:length(t)
+ if t(i)<T/2 then
+ x(i)=sin(2*%pi*t(i));
+ else
+ x(i)=0;
+ end
+end
+k=-10:10;
+for i=1:length(k)
+ if k(i)==1 then
+ ak(i)=1/(4*%i);
+ elseif k(i)==-1
+ ak(i)=-1/(4*%i);
+ else
+ ak(i)=(cos(k(i)*%pi/2)*exp(-k(i)*%pi/2*-%i))/(%pi-(%pi*k(i)*k(i)));
+ end
+end
+
+
+disp("The fourier series coefficients are...")
+disp(ak)
+disp("magnitude of Fourier series coefficient")
+disp(abs(ak))
+//PLotting frequency spectrum
+subplot(2,1,1)
+plot(k,abs(ak),'.');
+xtitle("Magnitude Spectrum","k","|ak|");
+for i=1:length(k)
+ if k(i)==0 | k(i)==3 | k(i)==-3 | k(i)==-5 |k(i)==5 then
+ phase(i)=0;
+ elseif k(i)==-1 then
+ phase(i)=%pi/2;
+ elseif k(i)==1 then
+ phase(i)=-%pi/2;
+ elseif k(i)==-2 | k(i)==-4
+ phase(i)=%pi;
+ elseif k(i)==2 | k(i)==4
+ phase(i)=-%pi;
+ else
+ phase(i) = 0;
+ end
+end
+subplot(2,1,2)
+plot(k,phase,'.');
+xtitle("Phase Spectrum","k","angle(ak)");
+disp(phase) \ No newline at end of file
diff --git a/2279/CH5/EX5.8/Ex5_8.sce b/2279/CH5/EX5.8/Ex5_8.sce
new file mode 100644
index 000000000..181ba1ef2
--- /dev/null
+++ b/2279/CH5/EX5.8/Ex5_8.sce
@@ -0,0 +1,23 @@
+//Fourier Series coefficients of half-wave rectifier output
+//Assume the period of the signal T=1
+t=-0.5:0.01:0.5;
+for i=1:length(t)
+ if t(i)<-0.25 & t(i)>0.25 then
+ x(i)=-1;
+ else
+ x(i)=1;
+ end
+end
+k=-10:10;
+for i=1:length(k)
+ if k(i)==0 then
+ ak(i)=0;
+ else
+ ak(i)=(%i*((2-(-1)^k(i))*exp(-%i*k(i)*%pi/2)-exp(%i*k(i)*%pi/2)))/(k(i)*2*%pi);
+ end
+end
+
+disp("The fourier series coefficients are...")
+disp(ak)
+plot(k,ak,'.')
+xtitle("Fourier Coefficients","k","ak")