0% found this document useful (1 vote)
3K views

Matched Filter Matlab Code

This Matlab code implements analog and sampled matched filtering. It takes in input signal values, generates the signal and impulse response for analog matched filtering, and plots the convolved output. It then performs similar steps for sampled matched filtering, generating the sampled signal and impulse response and plotting the convolved output.

Uploaded by

sahu487
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
3K views

Matched Filter Matlab Code

This Matlab code implements analog and sampled matched filtering. It takes in input signal values, generates the signal and impulse response for analog matched filtering, and plots the convolved output. It then performs similar steps for sampled matched filtering, generating the sampled signal and impulse response and plotting the convolved output.

Uploaded by

sahu487
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Matlab Code for Match filtering.

________________________________________________________________

clc;
clear all;
close all;
%=======================================================%
%Matched Filter%
%=======================================================%
A=input('Enter amplitude value= ');
r=input('enter input signal having length equal to 10');
%=======================================================%
%Analog Matched Filter%
%=======================================================%
s1=[0];
T=1:10;
s1=A*T;
s1=[s1 0 0 0]
h=0;
n=10
for t=1:10
h(n)=s1(t+A)
n=n-1
end
%=======================================================%
%Sampled matched Filter%
%=======================================================%
q=-max(T-A):-min(T-A);
s2=-A*T;
s2=[s2 0 0 0]
n=10;
for t=1:10
h2(n)=s2(t);
n=n-1;

end
%=======================================================%
%Analog Matched Filter Plotting%
%=======================================================%
figure(1)
subplot(3,1,1)
plot(s1,'r','linewidth',2)
title('Signal','fontsize',12)
xlabel('time\rightarrow')
ylabel('Amplitude\rightarrow')
grid on;
subplot(3,1,2)
plot(h,'r:','linewidth',2)
title('impulse response or mirror image','fontsize',12)
xlabel('time\rightarrow')
ylabel('Amplitude\rightarrow')
grid on;
y1=conv(s1,r)
subplot(3,1,3)
plot(y1,'r','linewidth',2)
title('Convolved output','fontsize',12)
xlabel('time\rightarrow')
ylabel('Amplitude\rightarrow')
grid on;
axis tight;
%=======================================================%
%Sampled Matched Filter Plotting%
%=======================================================%
y2=conv(s2,r)
figure(2)
subplot(2,1,1)
plot(q,h,'r-.','linewidth',2)
grid on;
subplot(2,1,2)

plot(s2,'m:','linewidth',2)
title('Signal','fontsize',12)
xlabel('time\rightarrow')
ylabel('Amplitude\rightarrow')
grid on;
axis tight;
figure(3)
subplot(2,1,1)
plot(h2,'r:','linewidth',2)
title('impulse response or mirror image','fontsize',12)
xlabel('time\rightarrow')
ylabel('Amplitude\rightarrow')
grid on;
subplot(2,1,2)
stem(y2,'linewidth',2)
title('Convolved output','fontsize',12)
xlabel('time\rightarrow')
ylabel('Amplitude\rightarrow')
grid on;
axis tight;

________________________________________________________________

You might also like