differentiating a fit formula
10 views (last 30 days)
Show older comments
Josh on 29 Nov 2022
Commented: Torsten on 30 Nov 2022
I wish to extract the fit formula or function along with its coefficients, then differentiate it to get its derivative function and also integrate the fit function to get its integration. How to do that please suggest.
[fit, gof] = createFit(x, y)
fx = differentiate(fit,x);
function [fitresult, gof] = createFit(x, y)
% Fit: 'untitled fit 1'.
[xData, yData] = prepareCurveData( x, y );
% Set up fittype and options.
ft = fittype( 'poly3' );
% Fit model to data.
[fitresult, gof] = fit( xData, yData, ft );
Walter Roberson on 29 Nov 2022
differentiate is specifically designed to differentiate cfit and sfit objects.
integrate is designed to integrate cfit objects.
Torsten on 30 Nov 2022
Isn't the derivative with respect to the fitting parameters required here ? [x.^3,x.^2,x] ?
More Answers (0)
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!