Smoothing signals with windows
Afficher commentaires plus anciens
Hi, I need to write a code to smooth out my estimated power spectral density. This is what i got so far
Simulating white noise
n=2^16;
Wn=randn(1,n);
plot(Wn)
xlim([0 n])
ylim([-4 4])
M=20;
Wn=Wn(1:floor(length(Wn)/M)*M);
parts=reshape(Wn,length(Wn)/M,M);
x=zeros(41,20);
for i=1:M
[temp,~]=acf(parts(1:end,i),M);
x(:,i)=temp(1:end,1);
end
xm=mean(x')';
X=(fft(xm));
RX1=abs(X).^2;
plot(0:1:length(RX1)-1,RX1)

This is the estimated PSD, so far so good, I guess? Bellow I try to smooth it.
k=7;
wind=rectwin(k);
filt=fir1(k-1,0.48,wind);
RX2= filter(filt,1,RX1);
plot(0:1:length(RX2)-1,RX2)

I keep changing the parameters but I dont know why my results always starts way bellow 1. Also, my course litterature does not go into detail about these windows. Any ideas?
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Spectral Estimation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!