MATLAB Answers

Hello i'm new use matlab. i would like to use savitzky golay to smooth my data. I have the data in .txt format. Can you help me how to plot my data and use the savgol filteriing? Thank you

3 views (last 30 days)
Simon Giando
Simon Giando on 10 Aug 2018
Commented: Ameer Hamza on 12 Aug 2018
Savitzky Golay Filtering


Sign in to comment.

Accepted Answer

Ameer Hamza
Ameer Hamza on 10 Aug 2018
You can use sgolayfilt() function from Signal Processing Toolbox. For reading data from txt file you can use textscan(). For plotting you can use plot() function. For a more comprehensive example, please attach a sample dataset.


Show 1 older comment
Ameer Hamza
Ameer Hamza on 11 Aug 2018
Here is a sample code
f = fopen('R_02.txt');
data = textscan(f, '%f %f', 'HeaderLines', 1);
x = data{1};
y = data{2};
y_filtered = sgolayfilt(y, 3, 11);

Sign in to comment.

Sign in to answer this question.

Translated by