cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Polyfit

TR_9781963
8-Gravel

Polyfit

I defined a function of x and y and plotted it. Later I am calculating matrix values for the function and trying to create a second function to fit the points. My belief was it should result in the first function but the second function deviated from first by large margin. How to rectify this? 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
ttokoro
20-Turquoise
(To:TR_9781963)

Here is my Prime 7 sheet.

image.png

View solution in original post

5 REPLIES 5
ttokoro
20-Turquoise
(To:TR_9781963)

You only use x=y's 21 points (green plot) of the function to polyfit it. 

Using all 441 points data to polyfit function, we get the next plot. Yellow plot is polyfit(,U,V, 2) and Red plot is polyfit(,U,V, 3). Polyfit area expands to -15,-14.5..15 for both x and y data.

image.pngimage.png

Can you please share the updated worksheet

While ttokoro is looking for his missing worksheet here are my 2 cents

Here you see in blue the points which you provided for polyfit to find a fitting surface and you see that polyfit succeeded in finding a surface of third order through all your points 😉

Werner_E_0-1643410736542.png

 

If you provide a full mesh of points you get the result you expected.

Werner_E_1-1643410765960.png

 

You may also use "polyfitc" to look for the factors which polyfit finds

Werner_E_2-1643410883308.png

The -0.2 in the row with "AAB" is the coefficient of x^2*y, etc.

 

Prime worksheet attached

 

 

ttokoro
20-Turquoise
(To:TR_9781963)

Here is my Prime 7 sheet.

image.png

One additional remark:

The 21 points you used were too special (because x = y for all of them) but normally 10 random points should suffice to define the cubic:

Werner_E_0-1643425563771.png

 

Top Tags