DSP Using Matlab
DSP Using Matlab
a = 1 4 10 17 27 31 28 17 15
b = 1 4 10 17 27 31 28 17 15
g = 2 9 20 36 60 72 64 57 40
i = 2 9 20 36 60 72 64 57 40
MatLab Code:-%% Experiment:- 03
function M=myconv(xn,hn)
l1=length(xn);
l2=length(hn);
N=l1+l2-1;
x1=[xn,zeros(1,l2-1)];
h1=[hn,zeros(1,l1-1)];
M=zeros(1,N);
for i=1:N
for j=1:i
% xn*hn
M(i)=M(i)+x1(j)*h1(i-j+1);
end
end
end
%%Auto and Cross Correlation
close all;
clear all;
clc
x=input('Enter x[n]=');
y=input('Enter y[n]=');
auto_corr=myconv(x,fliplr(x))
cross_corr=myconv(x,fliplr(y))
%%Plot The signal and Correaltion Figure
subplot(2,2,1);
stem(x);title('Signal X');
subplot(2,2,2);
stem(y);title('Signal Y');
subplot(2,2,3);
stem(auto_corr);title('Auto Correlation of Signal X');
subplot(2,2,4);
stem(cross_corr);title('Cross- Correlation of Signal X and Y');
auto_corr =
cross_corr =
Graph:-