Second degree polynomial fit

6 views (last 30 days)
Maarten van Sommeren
Maarten van Sommeren on 22 Jul 2016
Commented: Star Strider on 25 Jul 2016
Hi everyone,
R = c0-c1*(Tp)+c2*(Tp)^2,
I have a second degree polynomial function, where I have to fit the three constants (c0,c1,c2) The values for R and Tp are fixed, where R=998.9 and Tp=24.0 Can anyone help me out with this problem?
Regards,
Marc

Answers (1)

Star Strider
Star Strider on 22 Jul 2016
Edited: Star Strider on 22 Jul 2016
You have one equation in three unknowns, so there are an infinity of solutions. The solution you get depends on your initial parameter estimates:
R=998.9;
Tp=24.0;
f = @(c) c(1) - c(2).*Tp + c(3).*Tp^2 - R;
C0 = [1; 1; 1];
C = fsolve(f, C0)
One set of solutions with this ‘C0’:
C =
1.0013
0.9678
1.7728
  8 Comments
Maarten van Sommeren
Maarten van Sommeren on 25 Jul 2016
Thankyou! and if c2 is known, How do I fit the values of c0 and c1 subsequently?
Star Strider
Star Strider on 25 Jul 2016
My pleasure!
With only one value of ‘Tp’, regardless of the number of ‘R’ values you have, they are arbitrary. Choose a value for ‘c0’, then:
c1 = c0/Tp;
Since you’ve already calculated ‘c2’ from ‘Tp’ and ‘R’, neglecting ‘c0’ and ‘c1’ (assuming they are negligible), the remaining terms have to equate to 0.

Sign in to comment.

Categories

Find more on Get Started with Curve Fitting Toolbox 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!