# Curve Fitting By Using Multiple Functions Which Are Continuous At Junctions

There are some methods to do curve fitting using linear and non-linear methods. These methods approximate data points by a function. but how can we approximate our data points by using multiple functions which are continuous at junctions?

My data-set has a decreasing trend. I need to approximate it by using two reciprocal functions, f1(x) [x form 'a' to 'b'] and f2(x) [x from 'b' to 'c'], and Also I need C1 or C2 Continuity at b. Is there any hope?

Also i don`t want to use B-Spline because i need Ordinary Least Square instead of Total Least Square.

• You could use linear regression over each interval? – TSF Aug 5 '16 at 23:07
• can you share your data and the intervals? – msm Aug 5 '16 at 23:24
• Tony, I need C1 or C2 Continuity at b. – Ehsan Mirsaeedi Aug 6 '16 at 4:55

If you know that for $a \leq x \leq b$, you have to use $f_1(x)$ and that for $b \leq x \leq c$, you have to use $f_2(x)$, then standard linear or nonlinear regression will provide the parameters for each of the functions; this is a starting point.
Now, the problem is the continuity at $x=b$. This can correspond to different conditions, the simplest being $f_1(b)=f_2(b)$ and $f'_1(b)=f'_2(b)$ (but we could also require $f''_1(b)=f''_2(b)$).
For sure, the problem is more difficult is $b$ is to be determined too.