Constrain results of curve fitted equations to never exceed target data?
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
Below should be 2 graphs. I have used lsqcurvefit function within the optimisation toolbox to produce an equation which fits to target data using several variables and coefficients. The results of this equation are shown by the yellow line in the upper graph. The blue line represents the target data that I've tried to curve fit to. Ignore the red line. The lower graph shows the corresponding percentage errors relative to the points on the blue line.
My question is, is it possible to set a limit or edit the function in a way that it doesn't allow the result of the equation to exceed the target data. In other words, can I generate an equation, the graph of which would appear like the one shown but with the yellow line never going above the blue line (in the upper graph) and the percentage residual bars always being less than zero (lower graph)?
Any advice or help will be greatly appreciated.

Réponses (1)
Sean de Wolski
le 14 Juil 2015
0 votes
You'd have to write your own least squares objective function and then use fmincon (or MultiStart with fmincon, or patternsearch) to do the optimization. These solvers accept nonlinear constraints such as yours.
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!