Skip to main content
1-Visitor
July 9, 2018
Question

Quadratic fitting of data

  • July 9, 2018
  • 3 replies
  • 5112 views

Hello everyone

 

Attached to this post is a zip file with prime 3 sheet and an excel with the data. I need to fit this data using the following equation:

 

y = ax^2+bx+c

 

The solution I tried is not able to find an awnser.

 

Can anyone help me find a good fit to the data?

3 replies

25-Diamond I
July 9, 2018

@GvanBoven wrote:

Hello everyone

 

Attached to this post is a zip file with prime 3 sheet and an excel with the data. I need to fit this data using the following equation:

 

y = ax^2+bx+c

 

So why are you using pwrfit?? pwrfit (lookup the help!= tries to fit y=a*x^b+c and that has nothig to do with the quadratic fit you are looking for.

There are several way that this can be done in Prime

1) Use "polyfit". If you need to see the coefficients a,b,c, then use polyfitc

2) Use "linfit" with a vector consisting of 1,x and x^2 as function argument

3) Use "genfit". You can fit your data to any function you define with any number of parameters.

GvanBoven1-VisitorAuthor
1-Visitor
July 9, 2018

Hello Werner,

 

ah your right. I misread the formula of the pwrfit. I want to calculate a b and c so I guess I need to use the polyfit function. Thanks for the quick replay.

23-Emerald I
July 9, 2018

 The function you want is not pwrfit, you want polyfit.

GvanBoven1-VisitorAuthor
1-Visitor
July 9, 2018

Thank you Fred,

 

I am uncertain how I can caculate the  a b and c when I am using a polyfit function. Could you provide me with some more help?

 

23-Emerald I
July 9, 2018

@GvanBoven wrote:

Thank you Fred,

 

I am uncertain how I can caculate the  a b and c when I am using a polyfit function. Could you provide me with some more help?

 


Capture.PNG

25-Diamond I
July 9, 2018

Here are the three methods I mentioned before in comparison:

QFit.png

Worksheet attached is in P4 format, so your Prime 3 will not be able to read it (and P4 is not able to save in P3 format - what a shame!)

25-Diamond I
July 9, 2018

OK, just for fun and for "completeness" sake here are two more methods 😉

B2.png

In 5) I forgot about the good habit I mentioned in 4)

GvanBoven1-VisitorAuthor
1-Visitor
July 10, 2018

Thanks a lot Werner! I learned a lot from your last 2 posts