# I am looking for the concept about all-in-one curve fitting

I know that there are some Technic for finding curve fitting like polyfit() or pinv(). so we can get a some polynomial equation. it's OK good.

I can get successively a polynomial equation for each curve by using polyfit() or pinv()..it easy. no problem.

But my problems is here.

Actually I want to know a concept to make one equation which from all polynomial equations.

for example, if I get 3 equations(curve #1's equation ,curve #2's equation ,curve #3's equation) then I want to make all in one equation.\

Is this possible? what kinds of Technic is exist?

UPDATE:

I've got 4 polynomials

1) 3.1734x^3−5.8952x^2+3.8194x−0.0377

2) 2.1489x^3−3.9026x^2+2.8169x−0.0160

3) 1.0796x^3−1.9013x^2+1.8500x+0.0008

4) x

But I'm not sure how to apply your way about extracting the corresponding parameters. Would you please help me a small bit more ?

## 1 Answer

You can always augment the matrices to do so.

Let's assume the first model is given by:

$${y}_{1} = {H}_{1} * {\theta}_{1}$$

The second model is given by:

$${y}_{2} = {H}_{2} * {\theta}_{2}$$

The third model is given by:

$${y}_{3} = {H}_{3} * {\theta}_{3}$$

If we assume the number of parameters of the model are the same, namely ${\theta}_{1}, {\theta}_{2}, {\theta}_{3} \in {\mathbb{R}}^{d}$ and ${y}_{i} \in {\mathbb{R}}^{{n}_{i}}$ by the following augmentation:

$$y = H \theta$$

Where $y = {\left[ {{y}_{1}}^{T}, {{y}_{2}}^{T}, {{y}_{3}}^{T} \right]}^{T}$, $H = {\left[ {{H}_{1}}^{T} \mid {{H}_{2}}^{T} \mid {{H}_{3}}^{T} \right]}^{T}$ and $y = {\left[ {{\theta}_{1}}^{T}, {{\theta}_{2}}^{T}, {{\theta}_{3}}^{T} \right]}^{T}$ you can get:

$$\hat{\theta} = {\left( {H}^{T} H \right)}^{-1} {H}^{T} y$$

Extracting the the corresponding parameters is easy.

If the parameters vectors are not the same dimension, you can use zeros to make everything work.

• Sir I think you are miss understanding. Please check again the equations. there are must be 1) 3.1734x^3−5.8952x^2+3.8194x−0.0377 2) 2.1489x^3−3.9026x^2+2.8169x−0.0160 3) 1.0796x^3−1.9013x^2+1.8500x+0.0008 – gmotree Aug 11 '15 at 6:27