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 /2294/CH1/EX1.15/EX1_15.sce | |
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 '2294/CH1/EX1.15/EX1_15.sce')
-rwxr-xr-x | 2294/CH1/EX1.15/EX1_15.sce | 34 |
1 files changed, 34 insertions, 0 deletions
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<i>
+//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<ii>
+//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')
+
+
|