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 --- 2294/CH1/EX1.15/EX1_15.sce | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 2294/CH1/EX1.15/EX1_15.sce (limited to '2294/CH1/EX1.15/EX1_15.sce') diff --git a/2294/CH1/EX1.15/EX1_15.sce b/2294/CH1/EX1.15/EX1_15.sce new file mode 100755 index 000000000..d73b35af7 --- /dev/null +++ b/2294/CH1/EX1.15/EX1_15.sce @@ -0,0 +1,34 @@ +//Example 1.15 +//Find the even and odd components of the signal +clc; +clear; +t=-10:.1:10; +for j=1:length(t) + i=t(j); + x(j)=cos(i)+sin(i)+cos(i)*sin(i); + y(j)=cos(-i)+sin(-i)+cos(-i)*sin(-i); + e(j)=(1/2)*(x(j)+y(j)); + o(j)=(1/2)*(x(j)-y(j)); +end +disp('In the plot even component is in red and odd component is in blue') +plot(t,e,'red') +plot(t,o,'blue') +//Example 1.15 +//Find the even and odd components of the signal +clc; +clear; +n=-2:2; +c=3; +x=[-2 1 2 -1 3]; +for j=1:length(n) + i=n(j); + xe(j)=(1/2)*(x(c+i)+x(c-i)); + xo(j)=(1/2)*(x(c+i)-x(c-i)); +end +xe=[xe(c-2),xe(c-1),xe(c+0),xe(c+1),xe(c+2)]; +xo=[xo(c-2),xo(c-1),xo(c+0),xo(c+1),xo(c+2)]; + +disp(xo,'odd component') +disp(xe,'even component') + + -- cgit