using cfit objects with an optimization routine

2 views (last 30 days)
I've got a cfit object from the curvefitting toolbox and I want to use it in an optimization loop. I want to change the values of the coeffs in each optimization loop until it matches the desired output. (i've got the optimization bit sorted it's just the cfit that's causing me problems)
My idea was to deconstruct the cfit with
f = formula(cfit); c = coeffvalues(cfit)
- change the coeffvalues - and then put it back together with
fittedmodel = cfit(f,c).
I could then use the
y=fittedmodel(x)
syntax to evaluate the function.
Sadly I can't get this to work - anyone have any ideas?
thanks.

Answers (0)

Categories

Find more on Get Started with Optimization Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!