# What is the difference between cubic interpolation and cubic “Spline” interpolation?. How to use it for upsampling purpose?

Started by February 5, 2015
```After considering a couple of advices and suggestions for upsampling
techniques here, I finally converged to use the cubic interpolation
technique to estimate the voltage values corresponding to intermediate
samples present between the original or previous samples. I know that
spline interpolation is basically used for getting smoother curves, but
what makes it different from the normal cubic interpolation technique as
both of them use a 3rd degree polynomial to estimate intermediate values?.

Another implementation issue is that, for example, If I have some voltages
corresponding to some samples say

V = 3.674, 6.791, 8.888, 9.667.....
Sample = 2, 3, 4, 5.....

Now, If we have to find the voltage information corresponding to the
intermediate sample 3.5, then using cubic polynomial method, we arrive at 4
equations and 4 unknowns obtained by using the information provided by the
neighboring samples closest to sample 3.5.

V(2) = a + 2b + 4c + 8d
V(3) = a + 3b + 9c + 16d
V(4) = a + 4b + 16c + 64d
V(5) = a + 5b + 125c + 125d

So, solving these equations I arrived at

a = -4.428
b = 4.3756
c = -0.06299
d = -0.04966

Using these values , we can calculate the voltage value at the sample 3.5
as

V(3.5) = a + 3.5b + 12.25c + 42.875d
V(3.5) = 7.186 Volts

Now my question - Is this method of interpolation suitable for large
sampling rates?. How can I use this technique for upsampling a signal say
from 10 sps to 100 sps for N = 1024 sample points?. I know that i have to
develop a function that performs this cubic interpolation task between
original samples, but I am just wondering how to implement it for
upsampling for a continuous series of samples.Any suggestions, ideas or
advices regarding the topic and its implementation would be appreciated.
Thanks!

_____________________________
Posted through www.DSPRelated.com
```
```On Thu, 05 Feb 2015 06:29:53 -0600, DigitalGeek wrote:

> After considering a couple of advices and suggestions for upsampling
> techniques here, I finally converged to use the cubic interpolation
> technique to estimate the voltage values corresponding to intermediate
> samples present between the original or previous samples. I know that
> spline interpolation is basically used for getting smoother curves, but
> what makes it different from the normal cubic interpolation technique as
> both of them use a 3rd degree polynomial to estimate intermediate values?.
>
> Another implementation issue is that, for example, If I have some voltages
> corresponding to some samples say
>
>     V = 3.674, 6.791, 8.888, 9.667.....
>     Sample = 2, 3, 4, 5.....
>
> Now, If we have to find the voltage information corresponding to the
> intermediate sample 3.5, then using cubic polynomial method, we arrive at 4
> equations and 4 unknowns obtained by using the information provided by the
> neighboring samples closest to sample 3.5.
>
>     V(2) = a + 2b + 4c + 8d
>     V(3) = a + 3b + 9c + 16d
>     V(4) = a + 4b + 16c + 64d
>     V(5) = a + 5b + 125c + 125d
>
> So, solving these equations I arrived at
>
>    a = -4.428
>    b = 4.3756
>    c = -0.06299
>    d = -0.04966
>
> Using these values , we can calculate the voltage value at the sample 3.5
> as
>
>   V(3.5) = a + 3.5b + 12.25c + 42.875d
>   V(3.5) = 7.186 Volts

But if you have (many) more data points than 4, you're going to have to
do something more sophisticated (you surely don't want to go to a higher
order polynomial, as you apparently understand).  The various flavors of
splines introduce different assumptions for how the splines should be
joined (e.g. minimizing "strain energy", usually limiting higher-order
error derivatives and the like).

> Now my question - Is this method of interpolation suitable for large
> sampling rates?. How can I use this technique for upsampling a signal say
> from 10 sps to 100 sps for N = 1024 sample points?. I know that i have to
> develop a function that performs this cubic interpolation task between
> original samples, but I am just wondering how to implement it for
> upsampling for a continuous series of samples.Any suggestions, ideas or
> advices regarding the topic and its implementation would be appreciated.
> Thanks!

You have to know enough about your signal to know whether these splines
provide a sufficiently good approximation to the real underlying process.
This will hinge on how completely your sample points cover what is really
happening, and the validity of the assumptions your spline knots/joints
require.  This has more to do with the nature of your signal than anything
else.

HTH!
```
```>On Thu, 05 Feb 2015 06:29:53 -0600, DigitalGeek wrote:
>
>> After considering a couple of advices and suggestions for upsampling
>> techniques here, I finally converged to use the cubic interpolation
>> technique to estimate the voltage values corresponding to intermediate
>> samples present between the original or previous samples. I know that
>> spline interpolation is basically used for getting smoother curves, but
>> what makes it different from the normal cubic interpolation technique
as
>> both of them use a 3rd degree polynomial to estimate intermediate
values?.
>>
>> Another implementation issue is that, for example, If I have some
voltages
>> corresponding to some samples say
>>
>>     V = 3.674, 6.791, 8.888, 9.667.....
>>     Sample = 2, 3, 4, 5.....
>>
>> Now, If we have to find the voltage information corresponding to the
>> intermediate sample 3.5, then using cubic polynomial method, we arrive
at 4
>> equations and 4 unknowns obtained by using the information provided by
the
>> neighboring samples closest to sample 3.5.
>>
>>     V(2) = a + 2b + 4c + 8d
>>     V(3) = a + 3b + 9c + 16d
>>     V(4) = a + 4b + 16c + 64d
>>     V(5) = a + 5b + 125c + 125d
>>
>> So, solving these equations I arrived at
>>
>>    a = -4.428
>>    b = 4.3756
>>    c = -0.06299
>>    d = -0.04966
>>
>> Using these values , we can calculate the voltage value at the sample
3.5
>> as
>>
>>   V(3.5) = a + 3.5b + 12.25c + 42.875d
>>   V(3.5) = 7.186 Volts
>
>But if you have (many) more data points than 4, you're going to have to
>do something more sophisticated (you surely don't want to go to a higher
>order polynomial, as you apparently understand).  The various flavors of
>splines introduce different assumptions for how the splines should be
>joined (e.g. minimizing "strain energy", usually limiting higher-order
>error derivatives and the like).
>
>I understand that cubic interpolation can operate on 4 data points. The
more sophisticated technique I can think of is cubic spline. In case I am
using the normal cubic interpolation, how about I loop through the "N"
sample points i.e. 1024, for a condition below the "input sampling rate"
i.e. 10 sps considering 4 data points each and then performing the
interpolation function  based on the up sampling factor between each of
those 4 consecutive data points (Meaning - Interpolating/Estimating 10
values between each of those 4 data points) and then the function considers
the next 4 data points to perform the same operation and it goes on until a
100 samples has bee acquired i.e. the output sampling rate!
>
>> Now my question - Is this method of interpolation suitable for large
>> sampling rates?. How can I use this technique for upsampling a signal
say
>> from 10 sps to 100 sps for N = 1024 sample points?. I know that i have
to
>> develop a function that performs this cubic interpolation task between
>> original samples, but I am just wondering how to implement it for
>> upsampling for a continuous series of samples.Any suggestions, ideas or
>> advices regarding the topic and its implementation would be
appreciated.
>> Thanks!
>
>You have to know enough about your signal to know whether these splines
>provide a sufficiently good approximation to the real underlying process.
>This will hinge on how completely your sample points cover what is really
>happening, and the validity of the assumptions your spline knots/joints
>require.  This has more to do with the nature of your signal than
anything
>else.
>
>HTH!
>
> From my knowledge, I know that, my input signal is discrete, periodic in
nature (for a period of 1 sec) and lets say with a sampling rate of 10sps,
therefore to up sample it to 100 sps, I am sure that I have to interpolate
the input signal i.e. 10 sps by a factor of 10, by which I mean -
Interpolating/Estimating 10 new samples or voltage values between each
consecutive equally spaced 10 samples in the input signal to obtain a
sampling rate of 100 sps!

_____________________________
Posted through www.DSPRelated.com
```