Fit to just half a parabola

8 views (last 30 days)
Sven on 4 Mar 2015
Edited: Sven on 4 Mar 2015
Hi there, I have some simple XY data, and I can fit a quadratic to it as follows:
X = [25.4 30.48 35.56 40.64 45.72 50.8 63.5 76.2];
Y = [12443 9560.9 7381.1 5834.8 4740.6 3926.8 2723.5 2072.4];
p = polyfit(X,Y,2);
x1 = linspace(min(X),max(X),100);
y1 = polyval(p,x1);
figure, plot(X,Y,'o', x1, y1)
What I'd like to do however is to add a constraint and fit only the left half of a parabola. In other words, I would like to constrain my fit such that the underlying model (and therefore result) has a turning point at an X location equal to or greater than my maximum X observation.
How should go about applying such constraints? I'm guessing this is now an optimization toolbox problem rather than just solving a linear set of equations.
Thanks, Sven.

Answers (0)


Community Treasure Hunt

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

Start Hunting!

Translated by