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 /692/CH2/EX2.30 | |
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 '692/CH2/EX2.30')
-rwxr-xr-x | 692/CH2/EX2.30/P2_30.sce | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/692/CH2/EX2.30/P2_30.sce b/692/CH2/EX2.30/P2_30.sce new file mode 100755 index 000000000..121266d91 --- /dev/null +++ b/692/CH2/EX2.30/P2_30.sce @@ -0,0 +1,33 @@ +//EXAMPLE 2.30 +//Convolution of two sided sequences +clear; +clc; +g=[3 -2 4];//originating at n=-1 +h=[4 2 -1];//originating at n=0 +q=length(g); +w=length(h); +z=q+w-1; +y0=0; +for i=1:z; + y(i)=0; + for k=1:i; + if k>q + g(k)=0; + else + if (i-k+1)>w + h(i-k+1)=0; + else + y(i)= y(i) + g(k)*h(i-k+1); + end + end + end +end +n=-1:z-2; +disp(y,'The Convolution of the two sequences is =') +clf(); +a=gca(); +figure(0); +a.x_location="origin"; +plot2d3(n,y,2); +plot(n,y,'r.'); +xtitle('convolution','n','y'); |