Polynomial Fit of Rational Function

633 Views Asked by At

Given $n$ data points $(x_i,y_i)$ for $i = 1,\dots,n$ and polynomial $p(x)$ of degree $d$. What is the best way to numerically fit: $$ \frac{p(x)}{p(x)+1} = y $$ How would I do this in Matlab (in case it's easier to write code)?

2

There are 2 best solutions below

0
On BEST ANSWER

As I said in comments, the procedure proposed in Αδριανός's answer is the first step to be used since it makes the problem linear with respect to model parameters. However, a second step consisting in a nonlinear regression is required because what has been measured is $y$ and not $z=\frac{y}{1-y}$.

To illustrate the problem, I generated $51$ equally spaced data points $(0\leq x\leq 5)$ according to $$y=\frac{1}{100} \left\lfloor100 \frac{x^2+2 x+3}{x^2+2 x+4}\right\rfloor$$

Working with the $z$ values, the quadratic polynomial is given by $$p(x)=0.739154 x^2+2.28957 x+2.8133$$ Recomputing the $y$ values, this leads to a sum of squares equal to $0.000693$.

Now, using the above parameters as estimates for the nonlinear regression based on the $y$ values leads to $$p(x)=0.848136 x^2+1.93892 x+2.94349$$ which corresponds to a sum of squares equal to $0.000499$ which makes a significant difference for small errors.

Edit

Just for illustration puposes, I changed the coefficient $100$ to $50$. The preiliminary step gives $$p(x)=0.25453 x^2+3.77357 x+1.80677$$ which corresponds to a sum of squares equal to $0.019893$ while the nonlinear regression gives $$p(x)=0.688777 x^2+1.98693 x+2.8389$$ which corresponds to a sum of squares equal to $0.001678$.

7
On

I would re-arrange the equation to solve for $p(x)$ in terms of $y$.

I think it turns out to be equal to: $\frac{y}{1-y}$. Substitute all of the $y_i$'s into this form, and then use standard polynomial interpolation techniques to fit $p(x_i)=y_i'$.

Sorry, I am typing on a mobile device I will edit this answer to be more comprehensive once I am able to.