how to use the hanning window to smooth the photon signal
조회 수: 21 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (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:
clear;
N = 1024;
x = 0:N-1;
Whann = hann(N)';
y = rand(1,N); % Create some data
subplot(211);
plot(x,y);title('Original');grid minor;
subplot(212);
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.
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.
load('photon.mat')
% whos
figure
stairs(Photoncounts1)
grid
xlabel('Bin (?) Frequency (?)')
ylabel('Counts')
title('Photons')
xlim([0 600])
If this is a Fourier transform, the time to window the data was before calculating the transform.
.
댓글 수: 6
참고 항목
카테고리
Help Center 및 File Exchange에서 Filter Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!