MATLAB Answers

How does "smoothdata" function using "gaussian" method define the standard deviation for different window size?

55 ビュー (過去 30 日間)
Yue Xu
Yue Xu 2018 年 6 月 20 日
編集済み: Chris Turnes 2018 年 6 月 25 日
I have a row vector of data and want to smooth it using "smoothdata" as shown below:
>> g = [0.27 -0.13 0.3 -0.1 -0.12 -0.01 -0.21 -0.13 -0.11 -0.05 -0.26 0.04];
>> g_smooth = smoothdata(g, 'gaussian', 5)
g_smooth =
0.1330 0.0861 0.0728 -0.0039 -0.0703 -0.0971 -0.1313 -0.1338 -0.1139 -0.1154 -0.1196 -0.0715
I would like to know how "smoothdata" with "gaussian" method defines standard deviation for different window size. And also how "smoothdata" fills the data before the 1st data points and after the last data points when calculating the "gaussian-weighted average" for the 1st and last data points.

  0 件のコメント

Sign in to comment.


Chris Turnes
Chris Turnes 2018 年 6 月 25 日
編集済み: Chris Turnes 2018 年 6 月 25 日
The standard deviation of the Gaussian for smoothdata is fixed to be 1/5th of the total window width, so there is a direct linear scaling of the standard deviation with respect to the window width. There is currently no option to change this scaling, so the Gaussian shape is "fixed" (that is, you can think of increasing the window length as just increasing the sampling rate of the underlying filter).
It's also important to note that the Gaussian filter that is used is normalized so that it sums to 1.
With regards to how the endpoints are handled, they are treated the same way as NaN values are treated; namely, if a window has fewer valid points (either because it has reached the end or because there are NaN values being omitted) than specified by the window size, the window will be re-scaled so that the contributing coefficients sum to 1. This gives smoother behavior of the output at the endpoints and when there is missing data.

  0 件のコメント

Sign in to comment.

その他の回答 (0 件)




Translated by