Borrar filtros
Borrar filtros

Smoothing signals with windows

14 visualizaciones (últimos 30 días)
Sebastian Daneli
Sebastian Daneli el 9 de Oct. de 2020
Respondida: Shashank Gupta el 12 de Oct. de 2020
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?

Respuesta aceptada

Shashank Gupta
Shashank Gupta el 12 de Oct. de 2020
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

Más respuestas (0)

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by