Smoothing signals with windows

14 ビュー (過去 30 日間)
Sebastian Daneli
Sebastian Daneli 2020 年 10 月 9 日
回答済み: Shashank Gupta 2020 年 10 月 12 日
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?

採用された回答

Shashank Gupta
Shashank Gupta 2020 年 10 月 12 日
Hi Sebastian,
By the first look at the code, it seems correct. the starting point you talks about is way below 1 seems possible because of the filter window you are using, the rectangular filter window is not so perfect at the edges thus the behaviour you obtained. Try looking at other filter like hamming or binomial. I will suggest you to check out this link.
Although there are other functions you can use to smooth your signal like smooth function. these are not FIR filters but usually do a good job.
I hope I gave you enough information for you to get a good headstart.
cheers

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by