0% found this document useful (0 votes)
42 views5 pages

Digital Signal Processing Practical 3

Experiment 3 convolution and correlation Program 1: Convolution of two sequences: clc; clear all; close all; x=input('enter series x:'); h=input('enter series h:'); a=length(x) b=length(h) y=zeros(b,a+1) z=zeros(1,a+b-1); w=y; k=b; q=1; for j=1:b for i=a:-1:1 y(q,i+1)=h(k)*x(i); end q=q+1; k=k-1; end a=length(x); b=length(h); w=y; w(b,b-1)=y(b,b); w(b,b)=y(b,a+1); w(b,a+1)=0; ans=w m=1; f=1; for n=1:1:a+1 z(f)=ans(m,n)+ans(m+1,n); f=f+1; end final=z DIGITAL SIGNAL PROCESSING 7 SEMESTER ELECTR

Uploaded by

Atit Patel
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views5 pages

Digital Signal Processing Practical 3

Experiment 3 convolution and correlation Program 1: Convolution of two sequences: clc; clear all; close all; x=input('enter series x:'); h=input('enter series h:'); a=length(x) b=length(h) y=zeros(b,a+1) z=zeros(1,a+b-1); w=y; k=b; q=1; for j=1:b for i=a:-1:1 y(q,i+1)=h(k)*x(i); end q=q+1; k=k-1; end a=length(x); b=length(h); w=y; w(b,b-1)=y(b,b); w(b,b)=y(b,a+1); w(b,a+1)=0; ans=w m=1; f=1; for n=1:1:a+1 z(f)=ans(m,n)+ans(m+1,n); f=f+1; end final=z DIGITAL SIGNAL PROCESSING 7 SEMESTER ELECTR

Uploaded by

Atit Patel
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment 3

convolution and correlation

Program 1: Convolution of two sequences: clc; clear all; close all; x=input('enter series x:'); h=input('enter series h:'); a=length(x) b=length(h) y=zeros(b,a+1) z=zeros(1,a+b-1); w=y; k=b; q=1; for j=1:b for i=a:-1:1 y(q,i+1)=h(k)*x(i); end q=q+1; k=k-1; end a=length(x); b=length(h); w=y; w(b,b-1)=y(b,b); w(b,b)=y(b,a+1); w(b,a+1)=0; ans=w m=1; f=1; for n=1:1:a+1 z(f)=ans(m,n)+ans(m+1,n); f=f+1; end final=z

DIGITAL SIGNAL PROCESSING 7 SEMESTER ELECTRONICS & COMMUNICATION DIVISION : CX BATCH :- C3 ROLL NO. :- 40 ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT.
TH

Experiment 3

convolution and correlation


Output: enter series x:[1 2 4] enter series h:[4 5] a= 3 b= 2 y= 0 0 ans = 0 4 final = 4 21 18 20 5 10 16 8 20 0 0 0 0 0 0 0

DIGITAL SIGNAL PROCESSING 7 SEMESTER ELECTRONICS & COMMUNICATION DIVISION : CX BATCH :- C3 ROLL NO. :- 40 ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT.
TH

Experiment 3

convolution and correlation


Program 2: Correlation of two sequences: clc; clear all; close all; x=input('enter series x:'); h=input('enter series h:'); hh=h; a=length(x) b=length(h) cc=1; for c=cc:1:b h(cc)=hh(b) cc=cc+1; b=b-1; end reverce=h a=length(x) b=length(h) y=zeros(b,a+1) z=zeros(1,a+b-1); w=y; k=b; q=1; for j=1:b for i=a:-1:1 y(q,i+1)=h(k)*x(i); end q=q+1; k=k-1; end a=length(x); b=length(h); w=y; w(b,b-1)=y(b,b); w(b,b)=y(b,a+1); w(b,a+1)=0; ans=w m=1; f=1;

DIGITAL SIGNAL PROCESSING 7 SEMESTER ELECTRONICS & COMMUNICATION DIVISION : CX BATCH :- C3 ROLL NO. :- 40 ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT.
TH

Experiment 3

convolution and correlation


for n=1:1:a+1 z(f)=ans(m,n)+ans(m+1,n); f=f+1; end final=z Output: enter series x:[4 9 2] enter series h:[8 9] a= 3 b= 2 h= 9 h= 9 8 9

reverce = 9 a= 3 b= 8

DIGITAL SIGNAL PROCESSING 7 SEMESTER ELECTRONICS & COMMUNICATION DIVISION : CX BATCH :- C3 ROLL NO. :- 40 ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT.
TH

Experiment 3

2 y 0 ans = 0 32 72 16 36 18 81 0 final = 36 50 153 16 = 0 0 0 0 0 0 0

convolution and correlation

DIGITAL SIGNAL PROCESSING 7 SEMESTER ELECTRONICS & COMMUNICATION DIVISION : CX BATCH :- C3 ROLL NO. :- 40 ATMIYA INSTITUTE OF TECHNOLOGY & SCIENCE, RAJKOT.
TH

You might also like