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

Asked by Simon Giando on 10 Aug 2018
Latest activity Commented on by Ameer Hamza
on 12 Aug 2018
Savitzky Golay Filtering


Sign in to comment.

2 Answers

Answer by Ameer Hamza
on 10 Aug 2018
 Accepted Answer

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
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);
thank you very much. how if i would like to export the y_filtered to excel?
You can use xlswrite() to write the data from MATLAB to an excel file.

Sign in to comment.