Skip to content

Instantly share code, notes, and snippets.

@stephenHartzell
Created July 26, 2017 03:22
Show Gist options
  • Save stephenHartzell/24653b91ffb005827c4aa802904762e6 to your computer and use it in GitHub Desktop.
Save stephenHartzell/24653b91ffb005827c4aa802904762e6 to your computer and use it in GitHub Desktop.
% The reference signal
yref = [ones(1,56),zeros(1,200)];
% Initialize movie
v = VideoWriter('test.avi','Uncompressed AVI');
v.FrameRate = 10;
open(v)
figure('Position',[100 100 850 600])
MF(1) = sum(yN.*yref);
subplot(2,1,1), plot(yref+4,'g')
title('Shift and Sum')
hold on
plot(yN,'r')
plot(y,'--','color',[0 0 0])
set(gca,'xticklabel',[])
xlim([1,256])
ylim([-3,6])
legend('Ref Signal','Noisey Signal','Burried Signal')
hold off
subplot(2,1,2), plot(MF,'m')
xlim([1,256])
title('Matched Filter Output')
set(gca,'NextPlot','replacechildren');
for j = 1:length(yref)
MF(j) = sum(yN.*circshift(yref',j)');
% Initialize movie
subplot(2,1,1), plot(circshift(yref',j)+4,'g')
title('Shift and Sum')
hold on
plot(yN,'r')
plot(y,'--','color',[0 0 0])
set(gca,'xticklabel',[])
xlim([1,256])
ylim([-3,6])
legend('Ref Signal','Noisey Signal','Burried Signal')
hold off
subplot(2,1,2), plot(MF,'m')
xlim([1,256])
title('Matched Filter Output')
frame = getframe(gcf);
writeVideo(v, frame.cdata);
end
close(v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment