Can I control the number of output points in a smoothing spline fit?

1 回表示 (過去 30 日間)
Jenna Wardini
Jenna Wardini 2018 年 7 月 29 日
編集済み: Jenna Wardini 2018 年 7 月 29 日
I am using the 'fit' function in matlab to simultaneously smooth and interpolate a noisy data set I have.
Specifically, I want to use the smoothing spline fit that can be accessed through the curve fitting tool app.
I need to be able to choose the number of output points in the fit so I can match it up with a corresponding measurement I took that has a higher data sampling rate.
To clarify, my noisy data set I want to smooth/interpolate points for has 300 points, and my corresponding measurement has many 1000's of data points.
Is there a simple way to do this? I don't see options to control the # of output points in the documentation.
Here is my code:
[xData, yData] = prepareCurveData( pixStrain_index,
pixStrain_strain );
% Set up fittype and options.
ft = fittype( 'smoothingspline' );
opts = fitoptions( 'Method', 'SmoothingSpline' );
opts.SmoothingParam = 0.0571743604633104;
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft, opts );
% Plot fit with data.
figure( 'Name', 'SmoothingSpline' );
h = plot( fitresult, xData, yData );
'SmoothingSpline', 'Location', 'NorthEast' );
h = findobj(gca,'Type','line')
y =get(h,'Ydata') %strain
x =get(h,'Xdata') %index
pixStrain_index_interp = x{1, 1}
pixStrain_interp = y{1,1}
The number of points in pixStrain_interp is 1265, I need it to be something like 30,000 points.
  2 件のコメント
madhan ravi
madhan ravi 2018 年 7 月 29 日
Can you upload your code?
Jenna Wardini
Jenna Wardini 2018 年 7 月 29 日
Hi Madhan, I just pasted it under my question. I think this is not how you're supposed to do it but it is my first time posting so still getting the hang of things.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by