Averaging oscillating data points

41 vues (au cours des 30 derniers jours)
Mika Nicholas
Mika Nicholas le 26 Sep 2020
Commenté : Ameer Hamza le 27 Sep 2020
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.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 26 Sep 2020
Modifié(e) : Ameer Hamza le 26 Sep 2020
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 commentaires
Mika Nicholas
Mika Nicholas le 27 Sep 2020
Sort of worked. Havent used lowpass before, I've been trying to get it to behave more like a damped step unit response for my other data but can't work it out. Maybe movmean is my the simplest option for the other data.
Ameer Hamza
Ameer Hamza le 27 Sep 2020
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by