summaryrefslogtreecommitdiff
path: root/842/CH3
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /842/CH3
downloadScilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.gz
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.tar.bz2
Scilab-TBC-Uploads-b1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b.zip
initial commit / add all books
Diffstat (limited to '842/CH3')
-rwxr-xr-x842/CH3/EX3.10/Example3_10.sce38
-rwxr-xr-x842/CH3/EX3.11/Example3_11.sce67
-rwxr-xr-x842/CH3/EX3.12/Example3_12.sce32
-rwxr-xr-x842/CH3/EX3.13/Example3_13.sce63
-rwxr-xr-x842/CH3/EX3.14/Example3_14.sce33
-rwxr-xr-x842/CH3/EX3.15/Example3_15.sce26
-rwxr-xr-x842/CH3/EX3.2/Example3_2.sce80
-rwxr-xr-x842/CH3/EX3.3/Example3_3.sce19
-rwxr-xr-x842/CH3/EX3.4/Example3_4.sce45
-rwxr-xr-x842/CH3/EX3.5/Example3_5.sce46
-rwxr-xr-x842/CH3/EX3.6/Example3_6.sce35
-rwxr-xr-x842/CH3/EX3.7/Example3_7.sce48
-rwxr-xr-x842/CH3/EX3.8/Example3_8.sce77
13 files changed, 609 insertions, 0 deletions
diff --git a/842/CH3/EX3.10/Example3_10.sce b/842/CH3/EX3.10/Example3_10.sce
new file mode 100755
index 000000000..1731694d7
--- /dev/null
+++ b/842/CH3/EX3.10/Example3_10.sce
@@ -0,0 +1,38 @@
+//clear//
+//Example3.10:DTFS of x[n] =sin(Won)
+clear;
+close;
+clc;
+n = 0:0.01:5;
+N = 5;
+Wo = 2*%pi/N;
+xn = sin(Wo*n);
+for k =0:N-2
+ C(k+1,:) = exp(-sqrt(-1)*Wo*n.*k);
+ a(k+1) = xn*C(k+1,:)'/length(n);
+ if(abs(a(k+1))<=0.01)
+ a(k+1)=0;
+ end
+end
+a =a'
+a_conj = conj(a);
+ak = [a_conj($:-1:1),a(2:$)]
+k = -(N-2):(N-2);
+//
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-8,-1;8,1];
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+plot2d3('gnn',k,-imag(ak),5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+plot2d3('gnn',N+k,-imag(ak),5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+plot2d3('gnn',-(N+k),-imag(ak($:-1:1)),5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('ak')
diff --git a/842/CH3/EX3.11/Example3_11.sce b/842/CH3/EX3.11/Example3_11.sce
new file mode 100755
index 000000000..b9ec1f2b7
--- /dev/null
+++ b/842/CH3/EX3.11/Example3_11.sce
@@ -0,0 +1,67 @@
+//clear//
+//Example3.11:DTFS of
+//x[n] = 1+sin(2*%pi/N)n+3cos(2*%pi/N)n+cos[(4*%pi/N)n+%pi/2]
+clear;
+close;
+clc;
+N = 10;
+n = 0:0.01:N;
+Wo = 2*%pi/N;
+xn =ones(1,length(n))+sin(Wo*n)+3*cos(Wo*n)+cos(2*Wo*n+%pi/2);
+for k =0:N-2
+ C(k+1,:) = exp(-sqrt(-1)*Wo*n.*k);
+ a(k+1) = xn*C(k+1,:)'/length(n);
+ if(abs(a(k+1))<=0.1)
+ a(k+1)=0;
+ end
+end
+a =a';
+a_conj =conj(a);
+ak = [a_conj($:-1:1),a(2:$)];
+Mag_ak = abs(ak);
+for i = 1:length(a)
+ Phase_ak(i) = atan(imag(ak(i))/(real(ak(i))+0.0001));
+end
+Phase_ak = Phase_ak'
+Phase_ak = [Phase_ak(1:$-1) -Phase_ak($:-1:1)];
+k = -(N-2):(N-2);
+//
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',k,real(ak),5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('Real part of(ak)')
+xlabel(' k')
+subplot(2,1,2)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',k,imag(ak),5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('imaginary part of(ak)')
+xlabel(' k')
+//
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',k,Mag_ak,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('abs(ak)')
+xlabel(' k')
+subplot(2,1,2)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',k,Phase_ak,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('<(ak)')
+xlabel(' k')
diff --git a/842/CH3/EX3.12/Example3_12.sce b/842/CH3/EX3.12/Example3_12.sce
new file mode 100755
index 000000000..1f50c5c13
--- /dev/null
+++ b/842/CH3/EX3.12/Example3_12.sce
@@ -0,0 +1,32 @@
+//clear//
+//Example3.12:DTFS coefficients of periodic square wave
+clear;
+close;
+clc;
+N = 10;
+N1 = 2;
+Wo = 2*%pi/N;
+xn = ones(1,length(N));
+n = -(2*N1+1):(2*N1+1);
+a(1) = (2*N1+1)/N;
+for k =1:2*N1
+ a(k+1) = sin((2*%pi*k*(N1+0.5))/N)/sin(%pi*k/N);
+ a(k+1) = a(k+1)/N;
+ if(abs(a(k+1))<=0.1)
+ a(k+1) =0;
+ end
+end
+a =a';
+a_conj =conj(a);
+ak = [a_conj($:-1:1),a(2:$)];
+k = -2*N1:2*N1;
+//
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',k,real(ak),5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('Real part of(ak)')
+xlabel(' k')
diff --git a/842/CH3/EX3.13/Example3_13.sce b/842/CH3/EX3.13/Example3_13.sce
new file mode 100755
index 000000000..9b58c2b6e
--- /dev/null
+++ b/842/CH3/EX3.13/Example3_13.sce
@@ -0,0 +1,63 @@
+//clear//
+//Example3.13:DTFS
+//Expression of periodic sequence using
+//the summation two different sequence
+clear;
+close;
+clc;
+N = 5;
+n = 0:N-1;
+x1 = [1,1,0,0,1];
+x1 = [x1($:-1:1) x1(2:$)]; // Square Wave x1[n]
+x2 = [1,1,1,1,1];
+x2 = [x2($:-1:1) x2(2:$)];//DC sequence of x2[n]
+x = x1+x2;//sum of x1[n] & x2[n]
+//Zeroth DTFS coefficient of dc sequence
+c(1) = 1;
+//Zeroth DTFS coefficient of square waveform
+b(1) = 3/5;
+//Zeroth DTFS coefficient of sum of x1[n] & x2[n]
+a(1) = b(1)+c(1);
+//
+Wo = 2*%pi/N;
+for k =1:N-1
+ a(k+1) = sin((3*%pi*k)/N)/sin(%pi*k/N);
+ a(k+1) = a(k+1)/N;
+ if(abs(a(k+1))<=0.1)
+ a(k+1) =0;
+ end
+end
+a =a';
+a_conj =conj(a);
+ak = [a_conj($:-1:1),a(2:$)];
+k = -(N-1):(N-1);
+n = -(N-1):(N-1);
+//
+figure
+subplot(3,1,1)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',n,x,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('x[n]')
+xlabel(' n')
+subplot(3,1,2)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',n,x1,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('x1[n]')
+xlabel(' n')
+subplot(3,1,3)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',n,x2,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('x2[n]')
+xlabel(' n')
diff --git a/842/CH3/EX3.14/Example3_14.sce b/842/CH3/EX3.14/Example3_14.sce
new file mode 100755
index 000000000..194af6bf5
--- /dev/null
+++ b/842/CH3/EX3.14/Example3_14.sce
@@ -0,0 +1,33 @@
+//clear//
+//Example3.14:DTFS
+//Finding x[n] using parseval's relation of DTFS
+clear;
+close;
+clc;
+N = 6;
+n = 0:N-1;
+a(1) = 1/3;
+a(2)=0;
+a(4)=0;
+a(5)=0;
+a1 = (1/6)*((-1)^n);
+x =0;
+for k = 0:N-2
+ if(k==2)
+ x = x+a1;
+ else
+ x = x+a(k+1);
+ end
+end
+x = [x($:-1:1),x(2:$)];
+n = -(N-1):(N-1);
+//
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',n,x,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('x[n]')
+xlabel(' n')
diff --git a/842/CH3/EX3.15/Example3_15.sce b/842/CH3/EX3.15/Example3_15.sce
new file mode 100755
index 000000000..36afd07e0
--- /dev/null
+++ b/842/CH3/EX3.15/Example3_15.sce
@@ -0,0 +1,26 @@
+//clear//
+//Example3.15:DTFS:Periodic Convolution Property
+clear;
+clc;
+close;
+x = [1,1,0,0,0,0,1];
+X = fft(x);
+W = X.*X;
+w = ifft(W);
+w = abs(w);
+for i =1:length(x)
+ if (abs(w(i))<=0.1)
+ w(i) = 0;
+ end
+end
+w = [w($:-1:1) w(2:$)];
+N = length(x);
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',[-(N-1):0,1:N-1],w,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('w[n]')
+xlabel(' n')
diff --git a/842/CH3/EX3.2/Example3_2.sce b/842/CH3/EX3.2/Example3_2.sce
new file mode 100755
index 000000000..833cacfdf
--- /dev/null
+++ b/842/CH3/EX3.2/Example3_2.sce
@@ -0,0 +1,80 @@
+//clear//
+//Example 3.2:CTFS of a periodic signal x(t)
+//Expression of continuous time signal
+//using continuous time fourier series
+clear;
+close;
+clc;
+t = -3:0.01:3;
+//t1 = -%pi*4:(%pi*4)/100:%pi*4;
+//t2 =-%pi*6:(%pi*6)/100:%pi*6;
+xot = ones(1,length(t));
+x1t = (1/2)*cos(%pi*2*t);
+xot_x1t = xot+x1t;
+x2t = cos(%pi*4*t);
+xot_x1t_x2t = xot+x1t+x2t;
+x3t = (2/3)*cos(%pi*6*t);
+xt = xot+x1t+x2t+x3t;
+//
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-4,0;2 4];
+plot(t,xot)
+ylabel('t')
+title('xot =1')
+//
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-4,-3;2 4];
+plot(t,x1t)
+ylabel('t')
+title('x1(t) =1/2*cos(2*pi*t)')
+subplot(2,1,2)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-4,0;2 4];
+plot(t,xot_x1t)
+ylabel('t')
+title('xo(t)+x1(t)')
+//
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-4,-2;4 2];
+plot(t,x2t)
+ylabel('t')
+title('x2(t) =cos(4*pi*t)')
+subplot(2,1,2)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-4,0;4 4];
+plot(t,xot_x1t_x2t)
+ylabel('t')
+title('xo(t)+x1(t)+x2(t)')
+//
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-4,-3;4 3];
+plot(t,x3t)
+ylabel('t')
+title('x1(t) =2/3*cos(6*pi*t)')
+subplot(2,1,2)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-4,-3;4 3];
+plot(t,xt)
+ylabel('t')
+title('x(t)=xo(t)+x1(t)+x2(t)+x3(t)')
diff --git a/842/CH3/EX3.3/Example3_3.sce b/842/CH3/EX3.3/Example3_3.sce
new file mode 100755
index 000000000..68ce3d358
--- /dev/null
+++ b/842/CH3/EX3.3/Example3_3.sce
@@ -0,0 +1,19 @@
+//clear//
+//Example3.3:Continuous Time Fourier Series Coefficients of
+//a periodic signal x(t) = sin(Wot)
+clear;
+close;
+clc;
+t = 0:0.01:1;
+T = 1;
+Wo = 2*%pi/T;
+xt = sin(Wo*t);
+for k =0:5
+ 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:$)];
diff --git a/842/CH3/EX3.4/Example3_4.sce b/842/CH3/EX3.4/Example3_4.sce
new file mode 100755
index 000000000..a058dd87e
--- /dev/null
+++ b/842/CH3/EX3.4/Example3_4.sce
@@ -0,0 +1,45 @@
+//clear//
+//Example3.4:CTFS coefficients of a periodic signal
+//x(t) = 1+sin(Wot)+2cos(Wot)+cos(2Wot+%pi/4)
+clear;
+close;
+clc;
+t = 0:0.01:1;
+T = 1;
+Wo = 2*%pi/T;
+xt =ones(1,length(t))+sin(Wo*t)+2*cos(Wo*t)+cos(2*Wo*t+%pi/4);
+for k =0:5
+ C(k+1,:) = exp(-sqrt(-1)*Wo*t.*k);
+ a(k+1) = xt*C(k+1,:)'/length(t);
+ if(abs(a(k+1))<=0.1)
+ a(k+1)=0;
+ end
+end
+a =a';
+a_conj =conj(a);
+ak = [a_conj($:-1:1),a(2:$)];
+Mag_ak = abs(ak);
+for i = 1:length(a)
+ Phase_ak(i) = atan(imag(ak(i))/(real(ak(i))+0.0001));
+end
+Phase_ak = Phase_ak'
+Phase_ak = [Phase_ak(1:$) -Phase_ak($-1:-1:1)];
+figure
+subplot(2,1,1)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',[-k:k],Mag_ak,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('abs(ak)')
+xlabel(' k')
+subplot(2,1,2)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',[-k:k],Phase_ak,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('<(ak)')
+xlabel(' k')
diff --git a/842/CH3/EX3.5/Example3_5.sce b/842/CH3/EX3.5/Example3_5.sce
new file mode 100755
index 000000000..f40a4b0f5
--- /dev/null
+++ b/842/CH3/EX3.5/Example3_5.sce
@@ -0,0 +1,46 @@
+//clear//
+//Example3.5:CTFS coefficients of a periodic signal
+//x(t) = 1, |t|<T1, and 0, T1<|t|<T/2
+clear;
+close;
+clc;
+T =4;
+T1 = T/4;
+t = -T1:T1/100:T1;
+Wo = 2*%pi/T;
+xt =ones(1,length(t));
+//
+for k =0:5
+ C(k+1,:) = exp(-sqrt(-1)*Wo*t.*k);
+ a(k+1) = xt*C(k+1,:)'/length(t);
+ if(abs(a(k+1))<=0.1)
+ a(k+1)=0;
+ end
+end
+a =a';
+a_conj = real(a(:))-sqrt(-1)*imag(a(:));
+ak = [a_conj($:-1:1)',a(2:$)];
+k = 0:5;
+k = [-k($:-1:1),k(2:$)];
+Spectrum_ak = (1/2)*real(ak);
+//
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-2,0;2,2];
+plot2d(t,xt,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('x(t)')
+xlabel(' t')
+//
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+plot2d3('gnn',k,Spectrum_ak,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('abs(ak)')
+xlabel(' k')
diff --git a/842/CH3/EX3.6/Example3_6.sce b/842/CH3/EX3.6/Example3_6.sce
new file mode 100755
index 000000000..02f7b0e66
--- /dev/null
+++ b/842/CH3/EX3.6/Example3_6.sce
@@ -0,0 +1,35 @@
+//clear//
+//Example3.6: Time Shift Property of CTFS
+clear;
+close;
+clc;
+T =4;
+T1 = T/2;
+t = 0:T1/100:T1;
+Wo = 2*%pi/T;
+gt =(1/2)*ones(1,length(t));
+a(1)=0; //k=0, ak =0
+d(1)=0;
+for k =1:5
+ a(k+1) = (sin(%pi*k/2)/(k*%pi));
+ if(abs(a(k+1))<=0.01)
+ a(k+1)=0;
+ end
+ d(k+1) = a(k+1)*exp(-sqrt(-1)*k*%pi/2);
+end
+k = 0:5
+disp('Fourier Series Coefficients of Square Wave')
+a
+disp('Fourier Series Coefficients of g(t)=x(t-1)-0.5')
+d
+//
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-1,-2;1,4];
+plot2d([-t($:-1:1),t(1:$)],[-gt,gt],5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('g(t)')
+xlabel(' t')
diff --git a/842/CH3/EX3.7/Example3_7.sce b/842/CH3/EX3.7/Example3_7.sce
new file mode 100755
index 000000000..21bc9c5a0
--- /dev/null
+++ b/842/CH3/EX3.7/Example3_7.sce
@@ -0,0 +1,48 @@
+//clear//
+//Example3.7:Derivative Property of CTFS
+clear;
+clc;
+close;
+T =4;
+T1 = T/2;
+t = 0:T1/100:T1;
+xt = [t($:-1:1) t]/T1;
+gt =(1/2)*ones(1,length(t));
+e(1) = 1/2; //k =0, e0 = 1/2
+for k =1:5
+ a(k+1) = (sin(%pi*k/2)/(k*%pi));
+ if(abs(a(k+1))<=0.01)
+ a(k+1)=0;
+ end
+ d(k+1) = a(k+1)*exp(-sqrt(-1)*k*%pi/2);
+ e(k+1) = 2*d(k+1)/(sqrt(-1)*k*%pi);
+end
+k = 0:5
+disp('Fourier Series Coefficients of Square Wave')
+a
+disp('Fourier Series Coefficients of g(t)=x(t-1)-0.5')
+d
+disp('Fourier Series Coefficients of Triangular Wave')
+e
+//Plotting the time shifted square waveform
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-1,-2;1,2];
+plot2d([-t($:-1:1),t(1:$)],[-gt,gt],5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('g(t)')
+xlabel(' t')
+//Plotting the Triangular waveform
+figure
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-1,0;1,2];
+plot2d([-t($:-1:1),t(1:$)],xt,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('x(t)')
+xlabel('t')
diff --git a/842/CH3/EX3.8/Example3_8.sce b/842/CH3/EX3.8/Example3_8.sce
new file mode 100755
index 000000000..981eb80ed
--- /dev/null
+++ b/842/CH3/EX3.8/Example3_8.sce
@@ -0,0 +1,77 @@
+//clear//
+//Example3.8:Fourier Series Representation of Periodic Impulse Train
+clear;
+clc;
+close;
+T =4;
+T1 = T/4;
+t = [-T,0,T];
+xt = [1,1,1]; //Generation of Periodic train of Impulses
+t1 = -T1:T1/100:T1;
+gt = ones(1,length(t1));//Generation of periodic square wave
+t2 = [-T1,0,T1];
+qt = [1,0,-1];//Derivative of periodic square wave
+Wo = 2*%pi/T;
+ak = 1/T;
+b(1) = 0;
+c(1) = 2*T1/T;
+for k =1:5
+ b(k+1) = ak*(exp(sqrt(-1)*k*Wo*T1)-exp(-sqrt(-1)*k*Wo*T1));
+ if(abs(b(k+1))<=0.1)
+ b(k+1) =0;
+ end
+ c(k+1) = b(k+1)/(sqrt(-1)*k*Wo);
+ if(abs(c(k+1))<=0.1)
+ c(k+1) =0;
+ end
+end
+k = 0:5
+disp('Fourier Series Coefficients of periodic Square Wave')
+disp(b)
+disp('Fourier Series Coefficients of derivative of periodic square wave')
+disp(c)
+//Plotting the periodic train of impulses
+figure
+subplot(3,1,1)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-6,0;6,2];
+plot2d3('gnn',t,xt,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('x(t)')
+//Plotting the periodic square waveform
+subplot(3,1,2)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-6,0;6,2];
+plot2d(t1,gt,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+plot2d(T+t1,gt,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+plot2d(-T+t1,gt,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('g(t)')
+//Plotting the periodic square waveform
+subplot(3,1,3)
+a = gca();
+a.y_location = "origin";
+a.x_location = "origin";
+a.data_bounds=[-6,-2;6,2];
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+plot2d3('gnn',t2,qt,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+plot2d3('gnn',T+t2,qt,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+plot2d3('gnn',-T+t2,qt,5)
+poly1 = a.children(1).children(1);
+poly1.thickness = 3;
+title('q(t)')