fittype with user defined fit-function

2 views (last 30 days)
Stefanie
Stefanie on 28 Jun 2013
I have data where I create a fit from:
fit_curve=fit(x,y,'smoothingspline');
% x, y long vectors
This fit I use to define a fittype:
ft=fittype(@(a,b,x) a+fit_curve(x+b));
this fittype I use in another fitfunction
fit_2=fit(k,l,ft, 'StartPoint', [k(2) l(2));
% k, l vectors with 3 elements
this makes a beautiful fit. But if I change the fittype to
ft=fittype(@(a,b,x) a*fit_curve(x*b));
then the fit_2 is totally wrong.
I tried already .* or only replace one of the + by *. How to solve the problem? Let me know, if you need more information or the plots of the curves.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!