- Moving Average Filter: Smoothens the data by averaging neighboring points.
- Savitzky-Golay Filter: Fits successive sub-sets of adjacent data points with a low-degree polynomial by the method of linear least squares.
- Low-pass Filtering: Removes high-frequency components from the signal, which reduces oscillations.
Optimization of oscillations of a dataset
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello Everyone,
Currently I am working on minimization of oscillations of a data set to constrain its elements in a range. For example, consider pressure points that are obtained by mathematically (moment/force) during gait of a subject, and I want to optimize oscillations of points in order to prevent falling.
How can I do that? Which method should I use ?
0 comentarios
Respuestas (1)
Nipun
el 6 de Jun. de 2024
Hi Burak,
I understand that you want to minimize the oscillations in a dataset to constrain its elements within a specific range. Here are a few methods you can use in MATLAB to achieve this:
1. Moving Average Filter
data = your_data; % Replace with your data
windowSize = 5; % Adjust the window size as needed
smoothedData = movmean(data, windowSize);
figure;
plot(data, 'b', 'DisplayName', 'Original Data');
hold on;
plot(smoothedData, 'r', 'DisplayName', 'Smoothed Data');
legend;
title('Moving Average Filter');
xlabel('Time');
ylabel('Pressure Points');
For more information on "movmean", refer to the following MathWorks documentation: https://www.mathworks.com/help/matlab/ref/movmean.html
2. Savitzky-Golay Filter
data = your_data; % Replace with your data
polynomialOrder = 3; % Order of the polynomial
frameSize = 7; % Frame size (must be odd)
smoothedData = sgolayfilt(data, polynomialOrder, frameSize);
figure;
plot(data, 'b', 'DisplayName', 'Original Data');
hold on;
plot(smoothedData, 'r', 'DisplayName', 'Smoothed Data');
legend;
title('Savitzky-Golay Filter');
xlabel('Time');
ylabel('Pressure Points');
For more information on "sgolayfilt", refer to the following MathWorks documentation: https://www.mathworks.com/help/signal/ref/sgolayfilt.html
3. Low-pass Filtering
data = your_data; % Replace with your data
Fs = 100; % Sampling frequency, adjust as needed
Fc = 5; % Cut-off frequency, adjust as needed
[b, a] = butter(6, Fc/(Fs/2), 'low'); % 6th order Butterworth filter
smoothedData = filtfilt(b, a, data);
figure;
plot(data, 'b', 'DisplayName', 'Original Data');
hold on;
plot(smoothedData, 'r', 'DisplayName', 'Smoothed Data');
legend;
title('Low-pass Filter');
xlabel('Time');
ylabel('Pressure Points');
For more information on "butter", refer to the following MathWorks documentation: https://www.mathworks.com/help/signal/ref/butter.html
For more information on "filtfilt", refer to the following MathWorks documentation: https://www.mathworks.com/help/signal/ref/filtfilt.html
Each of these methods can help in minimizing oscillations and constraining the elements within a specified range. You may need to experiment with the parameters to achieve the desired level of smoothing for your specific dataset.
Hope this helps.
Regards,
Nipun
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!