Plotting and comparing modified periodograms

7 Ansichten (letzte 30 Tage)
Kostas Kostas
Kostas Kostas am 15 Jan. 2021
Hello guys,
I have plotted the modified periodogram of a signal using periodogram with the Hamming window, and tried to compare it with Hayes' mper() function from Statistical Digital Signal Processing and Modeling, 1996, pp 394. But the result isn't the same.
Could anyone point me where I am wrong?
clear all
clc
close all
ap1 = -2.737;
ap2 = 3.746;
ap3 = -2.629;
ap4 = 0.922;
a = [1, ap1, ap2, ap3, ap4];
b = 1.0;
figure(1)
Pz4=0;
Pz=0;
for j=1:50
S2 = filter(b,a,randn(2048,1));
[Px4,F4] = periodogram(S2,hamming(length(S2)),length(S2),1);
Pz4 = Pz4 + Px4;
Px=mper(S2,2);
Pz = Pz + Px;
end
plot(F4,10*log10(Pz/50));
hold on
plot(F4,10*log10(Pz4/50));
function Px = mper(x, win, n1, n2)
x = x(:);
if nargin == 2
n1 = 1; n2 = length(x);
end
N = n2 - n1 + 1;
switch win
case 1
w = rectwin(N);
case 2
w = hamming(N);
case 3
w = blackman(N);
end
xw = x(n1:n2).*w/norm(w);
Px = N*periodogram(xw);
end

Antworten (0)

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by