Can I control the number of output points in a smoothing spline fit?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!