summaryrefslogtreecommitdiff
path: root/716/CH2
diff options
context:
space:
mode:
authorpriyanka2015-06-24 15:03:17 +0530
committerpriyanka2015-06-24 15:03:17 +0530
commitb1f5c3f8d6671b4331cef1dcebdf63b7a43a3a2b (patch)
treeab291cffc65280e58ac82470ba63fbcca7805165 /716/CH2
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 '716/CH2')
-rwxr-xr-x716/CH2/EX2.1/MatLab_Prog2_1.sce46
-rwxr-xr-x716/CH2/EX2.13.a/Solved_Ex2_13a.sce14
-rwxr-xr-x716/CH2/EX2.13.b/Solved_Ex2_13b.sce14
-rwxr-xr-x716/CH2/EX2.13.c/Solved_Ex2_13c.sce14
-rwxr-xr-x716/CH2/EX2.13.d/Solved_Ex2_13d.sce14
-rwxr-xr-x716/CH2/EX2.13.e/Solved_Ex2_13e.sce14
-rwxr-xr-x716/CH2/EX2.22.b/Solved_Ex2_22b.sce17
-rwxr-xr-x716/CH2/EX2.23.a/Solved_Ex2_23a.sce27
-rwxr-xr-x716/CH2/EX2.3.a/Solved_Ex2_3a.sce25
-rwxr-xr-x716/CH2/EX2.3.b/Solved_Ex2_3b.sce32
-rwxr-xr-x716/CH2/EX2.3.c/Solved_Ex2_3c.sce27
-rwxr-xr-x716/CH2/EX2.3/MatLab_Prog_Ex2_3.sce11
-rwxr-xr-x716/CH2/EX2.4.a/Solved_Ex2_4a.sce20
-rwxr-xr-x716/CH2/EX2.4.b/Solved_Ex2_4b.sce18
-rwxr-xr-x716/CH2/EX2.4.c/Solved_Ex2_4c.sce20
-rwxr-xr-x716/CH2/EX2.4/MatLab_Prog_Ex2_4.sce50
-rwxr-xr-x716/CH2/EX2.5/Solved_Ex2_5.sce20
-rwxr-xr-x716/CH2/EX2.6/MatLab_ProgEx2_6.sce20
18 files changed, 403 insertions, 0 deletions
diff --git a/716/CH2/EX2.1/MatLab_Prog2_1.sce b/716/CH2/EX2.1/MatLab_Prog2_1.sce
new file mode 100755
index 000000000..cd67b0423
--- /dev/null
+++ b/716/CH2/EX2.1/MatLab_Prog2_1.sce
@@ -0,0 +1,46 @@
+//to generate standard signals like unit impulse,unit step,unit ramp,parabolic,sinusoidal,triangular pulse,signum,sinc and Gaussian signals
+clc;
+clear;
+t=-15:0.1:15;
+x=1.*(t==0);
+subplot(3,3,1)
+plot(t,x);
+xtitle('unit impulse signal','time t','signal x(t)');
+x=1.*(t>=0);
+subplot(3,3,2)
+plot(t,x);
+xtitle('unit step signal','time t','signal x(t)');
+x=t.*(t>=0);
+subplot(3,3,3)
+plot(t,x);
+xtitle('unit ramp signal','time t','signal x(t)');
+x=0.4*(t^2);
+subplot(3,3,4)
+plot(t,x);
+xtitle('parabolic signal','time t','signal x(t)');
+x=sin(%pi/5*t);
+subplot(3,3,5)
+plot(t,x);
+xtitle('sinusoidal signal','time t','signal x(t)');
+x=1-abs(t)/2;
+subplot(3,3,6)
+plot(t,x);
+xtitle('triangular signal','time t','signal x(t)');
+x=-1.*(t<0)+1.*(t>=0);
+subplot(3,3,7)
+plot(t,x);
+xtitle('signum signal','time t','signal x(t)');
+
+t1=0.01:0.01:15;
+x1=(sin(t1)./t1).*(t1>0.01)
+t2=-15:0.01:-0.01
+x2=(sin(t2)./t2).*(t2<-0.01)
+subplot(3,3,8)
+plot(t1,x1,t2,x2);
+xtitle('sinc signal','time t','signal x(t)');
+
+t=-15:0.01:15;
+x=exp(-1*1.*(t.^2));
+subplot(3,3,9)
+plot(t,x);
+xtitle('guassian signal','time t','signal x(t)'); \ No newline at end of file
diff --git a/716/CH2/EX2.13.a/Solved_Ex2_13a.sce b/716/CH2/EX2.13.a/Solved_Ex2_13a.sce
new file mode 100755
index 000000000..0cacda391
--- /dev/null
+++ b/716/CH2/EX2.13.a/Solved_Ex2_13a.sce
@@ -0,0 +1,14 @@
+//Test the Given systems for linearity,y(t)=t*x(t)
+clc;
+clear;
+function x=f1(t),x=t; ,endfunction//x function of t
+function y=f(t,x), y=x; ,endfunction//y function of y and t
+t=-5:0.1:5;
+x1=f1(t);
+x2=f1(t);
+x3=x1+x2;
+if f(t,x3)==(f(t,x1)+f(t,x2));
+ disp('system is linear');
+ else
+ disp('system is non linear');
+end
diff --git a/716/CH2/EX2.13.b/Solved_Ex2_13b.sce b/716/CH2/EX2.13.b/Solved_Ex2_13b.sce
new file mode 100755
index 000000000..d0b221ac5
--- /dev/null
+++ b/716/CH2/EX2.13.b/Solved_Ex2_13b.sce
@@ -0,0 +1,14 @@
+//Test the Given systems for linearity,y(t)=x(t^2)
+clc;
+clear;
+function x=f1(t),x=t'*t; ,endfunction//x function of t^2
+function y=f(t,x), y=x; ,endfunction//y function of y and t
+t=-5:0.1:5;
+x1=f1(t);
+x2=f1(t);
+x3=x1+x2;
+if f(t,x3)==(f(t,x1)+f(t,x2));
+ disp('system is linear');
+ else
+ disp('system is non linear');
+end
diff --git a/716/CH2/EX2.13.c/Solved_Ex2_13c.sce b/716/CH2/EX2.13.c/Solved_Ex2_13c.sce
new file mode 100755
index 000000000..bf2540ded
--- /dev/null
+++ b/716/CH2/EX2.13.c/Solved_Ex2_13c.sce
@@ -0,0 +1,14 @@
+//Test the Given systems for linearity,y(t)=x^2(t)
+clc;
+clear;
+function x=f1(t),x=t; ,endfunction//x function of t
+function y=f(t,x), y=x*x'; ,endfunction//y function of x and t
+t=-5:0.1:5;
+x1=f1(t);
+x2=f1(t);
+x3=x1+x2;
+if f(t,x3)==(f(t,x1)+f(t,x2));
+ disp('system is linear');
+ else
+ disp('system is non linear');
+end
diff --git a/716/CH2/EX2.13.d/Solved_Ex2_13d.sce b/716/CH2/EX2.13.d/Solved_Ex2_13d.sce
new file mode 100755
index 000000000..90f24052a
--- /dev/null
+++ b/716/CH2/EX2.13.d/Solved_Ex2_13d.sce
@@ -0,0 +1,14 @@
+//Test the Given systems for linearity,y(t)=Ax(t)+B
+clc;
+clear;
+function x=f1(t),x=t; ,endfunction//x function of t
+function y=f(t,x), y=5*x+2; ,endfunction//y function of x and t
+t=-5:0.1:5;
+x1=f1(t);
+x2=f1(t);
+x3=x1+x2;
+if f(t,x3)==(f(t,x1)+f(t,x2));
+ disp('system is linear');
+ else
+ disp('system is non linear');
+end
diff --git a/716/CH2/EX2.13.e/Solved_Ex2_13e.sce b/716/CH2/EX2.13.e/Solved_Ex2_13e.sce
new file mode 100755
index 000000000..780a7804f
--- /dev/null
+++ b/716/CH2/EX2.13.e/Solved_Ex2_13e.sce
@@ -0,0 +1,14 @@
+//Test the Given systems for linearity,y(t)=exp(x(t))
+clc;
+clear;
+function x=f1(t),x=t; ,endfunction//x function of t
+function y=f(t,x), y=exp(x); ,endfunction//y function of t and x
+t=-5:0.1:5;
+x1=f1(t);
+x2=f1(t);
+x3=x1+x2;
+if f(t,x3)==(f(t,x1)+f(t,x2));
+ disp('system is linear');
+ else
+ disp('system is non linear');
+end
diff --git a/716/CH2/EX2.22.b/Solved_Ex2_22b.sce b/716/CH2/EX2.22.b/Solved_Ex2_22b.sce
new file mode 100755
index 000000000..348e13afd
--- /dev/null
+++ b/716/CH2/EX2.22.b/Solved_Ex2_22b.sce
@@ -0,0 +1,17 @@
+//Perform Convolution of signals->x1=exp(-at) 0<=t<=T and x2=1 0<=t<=2T
+clc;
+clear;
+t=0:0.01:5;
+a=5;
+T=12;
+x1=exp(-a*t).*(t>=0&t<=T);
+x2=1.*(t>=0&t<=2*T);
+subplot(1,2,1)
+plot(t,x1);
+subplot(1,2,2)
+plot(t,x2);
+
+x=convol(x1,x2);
+t1=0:1:(length(x)-1);
+xset('window',1);
+plot(t1,x);
diff --git a/716/CH2/EX2.23.a/Solved_Ex2_23a.sce b/716/CH2/EX2.23.a/Solved_Ex2_23a.sce
new file mode 100755
index 000000000..7bad5d920
--- /dev/null
+++ b/716/CH2/EX2.23.a/Solved_Ex2_23a.sce
@@ -0,0 +1,27 @@
+//Perform Convolution of following signals
+//x1(t)=1 for 0<t<2 & x2(t)=1 for 0<t<1 & x2(t)=-1 for 1<t<2
+
+clc;
+clf;
+clear;
+
+t=-0.01:0.01:8;
+x1=1.*(0<=t&t<=2);
+x2=1.*(t>=0&t<=1)+(-1).*(t>=1&t<=2);
+y=convol(x1,x2);//performs convolution
+
+subplot(131)
+isoview(0,8,-5,5);
+plot(t,x1);//first signal
+xtitle('first signal X1(t)','time t','x1(t)');
+
+subplot(132)
+isoview(0,8,-5,5);
+plot(t,x2);//second signal
+xtitle('second signal X2(t)','time t','x2(t)');
+
+t1=0:0.01:(length(y)-1)*0.01;//sets time vector for y,output
+
+subplot(133)
+plot(t1,0.01*y);//output signal
+xtitle('convolution signal,x3(t)= X1(t)*x2(t)','time t','x3(t)'); \ No newline at end of file
diff --git a/716/CH2/EX2.3.a/Solved_Ex2_3a.sce b/716/CH2/EX2.3.a/Solved_Ex2_3a.sce
new file mode 100755
index 000000000..ef07f617c
--- /dev/null
+++ b/716/CH2/EX2.3.a/Solved_Ex2_3a.sce
@@ -0,0 +1,25 @@
+//Determine Even and Odd part of a CT signal x(t)=exp(t)
+clc;
+clear;
+clf;
+t=-10:0.01:10;
+x1=exp(t);
+x2=exp(-1*t);
+Xe=(x1+x2)/2;
+Xo=(x1-x2)/2;
+
+subplot(221)
+plot(t,x1);
+xtitle('the signal x(t)=exp(t)','time t','signal x(t)');
+
+subplot(222)
+plot(t,x2);
+xtitle('the signal x(-t)=exp(-t)','time t','signal x(t)');
+
+subplot(223)
+plot(t,Xe);
+xtitle('even part of the signal,Xe(t)=(x(t)+x(-t))/2','time t','signal x(t)');
+
+subplot(224)
+plot(t,Xo);
+xtitle('odd part of the signal,Xo(t)=(x(t)-x(-t))/2','time t','signal x(t)'); \ No newline at end of file
diff --git a/716/CH2/EX2.3.b/Solved_Ex2_3b.sce b/716/CH2/EX2.3.b/Solved_Ex2_3b.sce
new file mode 100755
index 000000000..b24dd5221
--- /dev/null
+++ b/716/CH2/EX2.3.b/Solved_Ex2_3b.sce
@@ -0,0 +1,32 @@
+//Determine Even and Odd part of a CT signal x(t)=3+2t+5t*t
+clc;
+clear;
+clf;
+t=poly(0,"t");
+x1=3+2*t+5*t.*t;
+x2=3+2*(-1)*t+5*t.*t;
+Xe=(x1+x2)/2;
+Xo=(x1-x2)/2;
+disp(Xe,'even part of Given function=>');
+disp(Xo,'odd part of Given function=>');
+
+t=-20:0.01:20;
+x1=3+2*t+5*t.*t;
+x2=3+2*(-1)*t+5*t.*t;
+Xe=(x1+x2)/2;
+Xo=(x1-x2)/2;
+subplot(221)
+plot(t,x1);
+xtitle('the signal x(t)=3+2t+5t*t','time t','signal x(t)');
+
+subplot(222)
+plot(t,x2);
+xtitle('the signal x(-t)=3-2t+5t*t','time t','signal x(t)');
+
+subplot(223)
+plot(t,Xe);
+xtitle('even part of the signal,Xe(t)=(x(t)+x(-t))/2','time t','signal x(t)');
+
+subplot(224)
+plot(t,Xo);
+xtitle('odd part of the signal,Xo(t)=(x(t)-x(-t))/2','time t','signal x(t)'); \ No newline at end of file
diff --git a/716/CH2/EX2.3.c/Solved_Ex2_3c.sce b/716/CH2/EX2.3.c/Solved_Ex2_3c.sce
new file mode 100755
index 000000000..0ddc10e23
--- /dev/null
+++ b/716/CH2/EX2.3.c/Solved_Ex2_3c.sce
@@ -0,0 +1,27 @@
+//Determine Even and Odd part of a CT signal x(t)=sin(2t)+cos(t)+sin(t)*cos(2t)
+clc;
+clear;
+clf;
+t=-20:0.01:20;
+x1=sin(2*t)+cos(t)+sin(t).*cos(2*t);
+x2=sin(-2*t)+cos(-1*t)+sin(-1*t).*cos(-2*t);
+Xe=(x1+x2)/2;
+Xo=(x1-x2)/2;
+disp(Xe,'even part of Given function=>');
+disp(Xo,'odd part of Given function=>');
+
+subplot(221)
+plot(t,x1);
+xtitle('the signal x(t)=exp(t)','time t','signal x(t)');
+
+subplot(222)
+plot(t,x2);
+xtitle('the signal x(-t)=exp(-t)','time t','signal x(t)');
+
+subplot(223)
+plot(t,Xe);
+xtitle('even part of the signal,Xe(t)=(x(t)+x(-t))/2','time t','signal x(t)');
+
+subplot(224)
+plot(t,Xo);
+xtitle('odd part of the signal,Xo(t)=(x(t)-x(-t))/2','time t','signal x(t)'); \ No newline at end of file
diff --git a/716/CH2/EX2.3/MatLab_Prog_Ex2_3.sce b/716/CH2/EX2.3/MatLab_Prog_Ex2_3.sce
new file mode 100755
index 000000000..dd0d2873f
--- /dev/null
+++ b/716/CH2/EX2.3/MatLab_Prog_Ex2_3.sce
@@ -0,0 +1,11 @@
+//find power of periodic signal x(t)=10sin(10*pi*t)
+clc;
+t=-0.5:0.01:0.5;
+x=10*sin(10*%pi*t);//given signal
+plot(t,x);
+n=length(t);
+
+//To calculate Power
+xsq=abs(x).^2;//adds squares of all the 'x' values(integrates 'x^2' terms)
+P=1/n*sum(xsq);//divide by n,to take the average rate of energy(gives power)
+disp('watts',P,'Power='); \ No newline at end of file
diff --git a/716/CH2/EX2.4.a/Solved_Ex2_4a.sce b/716/CH2/EX2.4.a/Solved_Ex2_4a.sce
new file mode 100755
index 000000000..fdd84d7d3
--- /dev/null
+++ b/716/CH2/EX2.4.a/Solved_Ex2_4a.sce
@@ -0,0 +1,20 @@
+//find power and energy of periodic signal x(t)=exp(-2t)*u(t)
+clc;
+//To plot signal*************************//
+t=-5:0.01:5;
+x=exp(-2*t).*(t>=0);//given signal
+plot(t,x);
+//**************************************//
+t=-50:0.01:50;
+x=exp(-2*t).*(t>=0);
+T=length(t);
+
+//To calculate Energy
+xsq=x.^2;//adds squares of all the 'x' values(integrates 'x^2' terms)
+v=inttrap(t,xsq);
+disp('joules',v,'Energy');
+
+//To calculate Power
+xsq=x.^2;
+P=1/T*v;//divide by 2T,to take the average rate of energy(gives power)
+disp('watts',P,'Power='); \ No newline at end of file
diff --git a/716/CH2/EX2.4.b/Solved_Ex2_4b.sce b/716/CH2/EX2.4.b/Solved_Ex2_4b.sce
new file mode 100755
index 000000000..534c6e36b
--- /dev/null
+++ b/716/CH2/EX2.4.b/Solved_Ex2_4b.sce
@@ -0,0 +1,18 @@
+//find power of periodic signal x(t)=exp(j(2t+pi/4))
+clc;
+//To plot signal*************************//
+t=-5:0.01:5;
+x=exp(%i*(2.*t+%pi/4));//given signal
+plot(t,x);
+//***************************************//
+t=-50:0.01:50
+x=exp(%i*(2.*t+%pi/4));
+T=length(t);
+
+//To calculate Energy
+xsq=abs(x).^2;//adds squares of all the 'x' values(integrates 'x^2' terms)
+v=sum(xsq);//energy
+
+//To calculate Power
+P=1/T*sum(xsq);//divide by T,to take the average rate of energy(gives power)
+disp('watts',P,'Power='); \ No newline at end of file
diff --git a/716/CH2/EX2.4.c/Solved_Ex2_4c.sce b/716/CH2/EX2.4.c/Solved_Ex2_4c.sce
new file mode 100755
index 000000000..a114d7aa9
--- /dev/null
+++ b/716/CH2/EX2.4.c/Solved_Ex2_4c.sce
@@ -0,0 +1,20 @@
+//find power of periodic signal x(t)=3cos(5*w0*t)
+clc;
+//To plot signal*************************//
+t=-5:0.01:5;
+w0=0.25*%pi;
+x=3*cos(5*w0.*t);//given signal
+plot(t,x);
+//***************************************//
+t=-50:0.01:50;
+x=3*cos(5*w0.*t);
+T=length(t);
+
+//To calculate Energy
+xsq=x.^2;//adds squares of all the 'x' values(integrates 'x^2' terms)
+v=sum(xsq);//energy
+
+//To calculate Power
+xsq=x.^2;
+P=1/T*v;//divide by 2T,to take the average rate of energy(gives power)
+disp('watts',P,'Power='); \ No newline at end of file
diff --git a/716/CH2/EX2.4/MatLab_Prog_Ex2_4.sce b/716/CH2/EX2.4/MatLab_Prog_Ex2_4.sce
new file mode 100755
index 000000000..c250770d7
--- /dev/null
+++ b/716/CH2/EX2.4/MatLab_Prog_Ex2_4.sce
@@ -0,0 +1,50 @@
+//Perform Amplitude Scaling,Time Scaling and Time Shift on x(t)=1+t for t=0 to 2
+clc;
+clear;
+clf;
+t=-5:0.01:5;
+x=(1+t).*(t>=0&t<=2)
+
+//Amplitude Scaling
+xset('window',0);
+subplot(131)
+plot(t,x);
+xtitle('the original signal x(t)=1+t for 0<=t<=2','time t','signal x(t)');
+
+subplot(132)
+plot(t,5*x);
+xtitle('amplitude scaling of x(t)=t','time t','signal 5*x(t)');
+
+subplot(133)
+plot(t,0.5*x);
+xtitle('amplitude scaling of x(t)=t','time t','signal 0.5*x(t)');
+
+//Time Scaling
+xset('window',1);
+subplot(131)
+plot(t,x);
+xtitle('the original signal x(t)=1+t for 0<=t<=2','time t','signal x(t)');
+
+subplot(132)
+plot(t*2,x);
+xtitle('Time Scaling of x(t)','time 2*t','signal x(2t)');
+
+subplot(133)
+plot(t/2,x);
+xtitle('Time Scaling of x(t)','time t/2','signal x(t/2)');
+
+//Time Shifting
+xset('window',2)
+subplot(131)
+plot(t,x);
+xtitle('the original signal x(t)=1+t for 0<=t<=2','time t','signal x(t)');
+
+subplot(132)
+t=t+3;
+plot(t,x);
+xtitle('Time Shifting of x(t)','time t','signal x(t-3)');
+
+subplot(133)
+t=t-6;
+plot(t,x);
+xtitle('Time Shifting of x(t)','time t+3','signal x(t+3)'); \ No newline at end of file
diff --git a/716/CH2/EX2.5/Solved_Ex2_5.sce b/716/CH2/EX2.5/Solved_Ex2_5.sce
new file mode 100755
index 000000000..aeab01280
--- /dev/null
+++ b/716/CH2/EX2.5/Solved_Ex2_5.sce
@@ -0,0 +1,20 @@
+//sketch x(-t) and x(2-t)
+//for x(t)=t for 0<=t<=3 and x(t)=0 for t>3
+clc;
+clear;
+clf;
+t=-5:0.01:5;
+x=t.*(t>=0&t<=3)+0.*(t>3);
+subplot(131)
+plot(t,x);//displays original function x(t)
+xtitle('the original signal x(t)=t for 0<=t<=3','time t','signal x(t)');
+
+t=-1*t;
+subplot(132)
+plot(t,x);//displays x(-t)
+xtitle('the signal x(-t)','time t','signal x(-t)');
+
+t=2+t;
+subplot(133)
+plot(t,x);//displays x(2-t)
+xtitle('the signal x(2-t)','time t','signal x(2-t)'); \ No newline at end of file
diff --git a/716/CH2/EX2.6/MatLab_ProgEx2_6.sce b/716/CH2/EX2.6/MatLab_ProgEx2_6.sce
new file mode 100755
index 000000000..dc430d10e
--- /dev/null
+++ b/716/CH2/EX2.6/MatLab_ProgEx2_6.sce
@@ -0,0 +1,20 @@
+//Perform Convolution of x1(t)=1 for 1<t<10 & x2(t)=1 for 2<t<10
+clc;
+t=0:0.01:15;
+x1=1.*(t>1&t<10);
+x2=1.*(t>2&t<10);
+y=convol(x1,x2);
+n=length(y);//setting time vector for y
+ty=0:1:(n-1);
+
+subplot(131)
+plot2d(t,x1);//first signal
+xtitle('first signal x1(t)=1 for 1<t<10','time t','x1(t)');
+
+subplot(132)
+plot2d(t,x2);//second signal
+xtitle('second signal x2(t)=1 for 2<t<10','time t','x2(t)');
+
+subplot(133)
+plot2d(ty,y);//output signal after convolution
+xtitle('convolution of x1 & x2','time t','x1(t)*x2(t)'); \ No newline at end of file