
Averaging oscillating data points
조회 수: 7 (최근 30일)
이전 댓글 표시
I have some multiple sets of temperature readings of some air heated by a pulsing heater, so the data is not strictly sinusoidal. I want to average these pulses to create a smooth curve, the main issue is that the oscillations in the data have varying frequency and amplitude, how can I do this?
I have been trying the movmean function which has done a reasonable job at creating an average of the points however some oscillations, albeit much smaller, still manifest. I believe this is due to the varying frequency, I might be able to try to create a smoother curve by trying different span values, however, I don't believe it will ever create an oscillation free curve due to the function never being in phase for the whole data set. I've looked into the smooth function but not really worked it out and I think I may get the same issue. Manually trying different parameters for each data set will be time consuming so I am hoping there is another way but if there isn't, I guess I don't have a choice. I could also do an iterative process maybe to generate a smooth curve but due to the varying frequency, I don't know if, I would know how to do that.
I have attached some of my data I'm am trying to do this for.
Note: The first rise in the data is not an oscillation I am trying to dampen, the oscillations I want to damp/smooth are relatively small to the range, on the scale of <0.5 peak to peak amplitude.
댓글 수: 0
채택된 답변
Ameer Hamza
2020년 9월 26일
편집: Ameer Hamza
2020년 9월 26일
Try lowpass filter if you have signal processing toolbox
data = readmatrix('SampleTempData.xlsx');
t = data(:,1);
x = data(:,2);
dT = t(2) - t(1);
Fs = 1/dT;
y = lowpass(x, 0.001, Fs, 'ImpulseResponse', 'iir');
plot(t, x)
hold on
plot(t, y)
legend({'actual', 'filtered'}, 'FontSize', 16, 'Location', 'best')

댓글 수: 2
Ameer Hamza
2020년 9월 27일
If this was a damped step response, then seem to be to much noise and bias in the sensor values. I don't think frequency domain filtering techniques, such as movmean and lowpass is the correct way to do this. You may look for a model-based filtering method, such as Kalman filter, to get the filtered output.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!