# Cubic Regression - Math/Numerical Question

This is a discussion on Cubic Regression - Math/Numerical Question within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Hi there, How do I implement cubic regression? I.e. given a series of x-y data points, how do I find ...

1. ## Cubic Regression - Math/Numerical Question

Hi there,

How do I implement cubic regression? I.e. given a series of x-y data points, how do I find the coefficients:

y = ax^3 + bx^2 + cx + d

Am aware that if I differentiate twice, I get:

d2y/dsx2 = 6ax + 2b

so if I can numerically differentiate my x-y data twice, I can find constants a & b by linear regression.

How do I go about differentiating the data. And how do I find constants c & d?

Or is there a better approach?

2. http://en.wikipedia.org/wiki/Linear_regression

This gets into Linear Algebra.

>This gets into Linear Algebra.

I can do the linear regression bit. But...

how do I transform a cubic in order to determine all the constants?

http://www.efunda.com/math/leastsqua...sqrmdcurve.cfm
http://www.efunda.com/math/leastsqua...astsquares.cfm

These pages seem good, there's a linear example as well.

To do this in MATLAB, use the polyfit() function.

5. why not just use the cubic regression from your TI-83 ?