Smoothing signals with windows
이전 댓글 표시
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?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Descriptive Statistics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!