Skip to content

Commit

Permalink
welch periodogram window reduced
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauochoa committed Nov 23, 2020
1 parent 727a661 commit f7381ee
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
33 changes: 18 additions & 15 deletions main.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

filepath = 'test_real_long.dat';

signal = DataReader(filepath, Inf);
% signal = DataReader(filepath, Inf);

load('subsignal.mat');

Expand Down Expand Up @@ -33,21 +33,24 @@
Rs = xcorr(s, 'biased');
Ss = fft(Rs, 2*N);

figure;
plot(fftshift(abs(Ss)));
title("Spectral density from autocorrelation");
xlabel('w');

[Ss, f] = periodogram(s, rectwin(length(s)), fs);
figure
plot(f, Ss);
title("Spectral density from autocorrelation");
xlabel('f (Hz)');

[Swelch, fwelch] = pwelch(s, [], [], [], fs);
% figure;
% plot(fftshift(abs(Ss)));
% title('Spectral density from autocorrelation');
% xlabel('w');
%
% [Ss, f] = periodogram(s, rectwin(length(s)), [], fs);
% figure
% plot(f/1e6, 10*log10(Ss));
% % plot([-flip(f); f], [flip(Ss); Ss]);
% title('Periodogram');
% xlabel('f (MHz)'); ylabel('PSD (dB/Hz)')

[Swelch, fwelch] = pwelch(s, 30, 15, [], fs);
figure
plot([-flip(fwelch) fwelch], [flip(Swelch) Swelch]);
xlabel('f (Hz)'); ylabel('PSD (dB/Hz)');
% plot([-flip(fwelch); fwelch]./1e6, [flip(Swelch); Swelch]);
plot(fwelch./1e6, 10*log10(Swelch)); hold on;
xline(fIF/1e6);
xlabel('f (MHz)'); ylabel('PSD (dB/Hz)');
title('Welch periodogram');


Expand Down
5 changes: 0 additions & 5 deletions main.m~

This file was deleted.

0 comments on commit f7381ee

Please sign in to comment.