how to use the hanning window to smooth the photon signal

23 ビュー (過去 30 日間)
yuxuan 2024 年 2 月 19 日
コメント済み: Star Strider 2024 年 2 月 20 日
windowLength = 91;
hannWindow = hann(windowLength);
smooth_data = conv2(data, hannWindow, 'same');
is the code correct? Because when i increase the windowlength, the smooth_data will increase as well

回答 (2 件)

Alexander 2024 年 2 月 19 日
I can't see this effect you mentioned. smooth_data remains the same size as data (I assume data = Photoncounts1). What do you expect? I never used windowing in the manner you have done it in the code above. Usually I multiplied the data with the window (or parts of the window) in the time domain to get rid of the step function and having a clear transient effect before a fft. Just an example:
N = 1024;
x = 0:N-1;
Whann = hann(N)';
y = rand(1,N); % Create some data
plot(x,y);title('Original');grid minor;
plot(x,y.*Whann);title('Windowed');grid minor;
  3 件のコメント
Alexander 2024 年 2 月 20 日
Once again: A hann window is not made for smoothing data, but to minimize the effect of a rectangular function (start of measurement <-> end of measurement) in the time domain. If your signal is time domain data, use a filter.
yuxuan 2024 年 2 月 20 日
The following sentences are what i found in eassys about using hanning window to smooth data:
'vertically smoothed by a running Hanning window with FWHM width of 2 or 1 km'
'smoothed by sliding a 2‐km full width at half maximum (FWHM) Hanning window in the vertical direction in the temperature retrieval process '
'The smoothing of the signal plus background is by a Hanning filter with a 2-km FWHM window'


Star Strider
Star Strider 2024 年 2 月 19 日
That appears to be some sort of spectrum. I am not certain what you want to do with it, however windowing it is not likely to produce any benefit at this point.
% whos
xlabel('Bin (?) Frequency (?)')
xlim([0 600])
If this is a Fourier transform, the time to window the data was before calculating the transform.
  6 件のコメント
yuxuan 2024 年 2 月 20 日
I appreciate your answers, i will try
Star Strider
Star Strider 2024 年 2 月 20 日
Thank you!



Help Center および File ExchangeSmoothing and Denoising についてさらに検索




Community Treasure Hunt

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

Start Hunting!

Translated by