From: Giovanni Richmon on
Dear community,

For the given x and y=f(x) values, I would like to obtain b-spline coefficients.
How do I obtain these coefficients? I there an easy and fast way to do this with Matlab?

Example:
N=number of nodes
xi=0;
xe=pi/2;
x=linspace(xi,xe,N);
y=sin(x);
if quadratic b-splines are constructed, then there must be N+1 coefficents (c) for N nodes
and we have N equations
0.5 c(1)+0.5 c(2)=y(1)
0.5 c(2) +0.5 c(3)=y(2)
....
0.5 c(N) +0.5 c(N+1)=y(N)

In addition, it can be considered to add one more equation while considering boundary condition.
For exmple: y'(pi/2)=0;
so
-c(N)+c(N+1)=0 for quadratic case

Is there a matlab function to do this consideration for cubic, quadratic b-splines,...?

Best Regards

Giovanni
From: Matt on
"Giovanni Richmon" <g.richmon(a)yahoo.co.uk> wrote in message <h7rcte$8ho$1(a)fred.mathworks.com>...
> Dear community,
>
> For the given x and y=f(x) values, I would like to obtain b-spline coefficients.
> How do I obtain these coefficients? I there an easy and fast way to do this with Matlab?
>
> Example:
> N=number of nodes
> xi=0;
> xe=pi/2;
> x=linspace(xi,xe,N);
> y=sin(x);
> if quadratic b-splines are constructed, then there must be N+1 coefficents (c) for N nodes
> and we have N equations
> 0.5 c(1)+0.5 c(2)=y(1)
> 0.5 c(2) +0.5 c(3)=y(2)
> ...
> 0.5 c(N) +0.5 c(N+1)=y(N)
>
> In addition, it can be considered to add one more equation while considering boundary condition.
> For exmple: y'(pi/2)=0;
> so
> -c(N)+c(N+1)=0 for quadratic case
>
> Is there a matlab function to do this consideration for cubic, quadratic b-splines,...?
>
> Best Regards
>
> Giovanni

There is this toolbox in the file exchange, but I haven't tried it.

http://www.mathworks.com/matlabcentral/fileexchange/19632
From: Giovanni Richmon on
Thank you Matt for your help.
But it is not suitable to use this file.

Giovanni

"Matt " <xys(a)whatever.com> wrote in message <h7rgur$qha$1(a)fred.mathworks.com>...
> "Giovanni Richmon" <g.richmon(a)yahoo.co.uk> wrote in message <h7rcte$8ho$1(a)fred.mathworks.com>...
> > Dear community,
> >
> > For the given x and y=f(x) values, I would like to obtain b-spline coefficients.
> > How do I obtain these coefficients? I there an easy and fast way to do this with Matlab?
> >
> > Example:
> > N=number of nodes
> > xi=0;
> > xe=pi/2;
> > x=linspace(xi,xe,N);
> > y=sin(x);
> > if quadratic b-splines are constructed, then there must be N+1 coefficents (c) for N nodes
> > and we have N equations
> > 0.5 c(1)+0.5 c(2)=y(1)
> > 0.5 c(2) +0.5 c(3)=y(2)
> > ...
> > 0.5 c(N) +0.5 c(N+1)=y(N)
> >
> > In addition, it can be considered to add one more equation while considering boundary condition.
> > For exmple: y'(pi/2)=0;
> > so
> > -c(N)+c(N+1)=0 for quadratic case
> >
> > Is there a matlab function to do this consideration for cubic, quadratic b-splines,...?
> >
> > Best Regards
> >
> > Giovanni
>
> There is this toolbox in the file exchange, but I haven't tried it.
>
> http://www.mathworks.com/matlabcentral/fileexchange/19632
From: Matt on
"Giovanni Richmon" <g.richmon(a)yahoo.co.uk> wrote in message <h7rcte$8ho$1(a)fred.mathworks.com>...
> Dear community,
>
> For the given x and y=f(x) values, I would like to obtain b-spline coefficients.
> How do I obtain these coefficients? I there an easy and fast way to do this with Matlab?
>
> Example:
> N=number of nodes
> xi=0;
> xe=pi/2;
> x=linspace(xi,xe,N);
> y=sin(x);
> if quadratic b-splines are constructed, then there must be N+1 coefficents (c) for N nodes

Why N as opposed to N+1? Normally, you have 1 coefficient per node.

> and we have N equations
> 0.5 c(1)+0.5 c(2)=y(1)
> 0.5 c(2) +0.5 c(3)=y(2)
> ...
> 0.5 c(N) +0.5 c(N+1)=y(N)
>
> In addition, it can be considered to add one more equation while considering boundary condition.
> For exmple: y'(pi/2)=0;
> so
> -c(N)+c(N+1)=0 for quadratic case
>
> Is there a matlab function to do this consideration for cubic, quadratic b-splines,...?

Why not just derive the equations for the cubic case and solve them... You seem to have done fine for the quadratic case.


From: Giovanni Richmon on
Quadratic and Cubic case is not a problem.
But if higher order b-splines are used, it can be suitable to find the coefficients easily.

Giovanni

"Matt " <xys(a)whatever.com> wrote in message <h8egke$87q$1(a)fred.mathworks.com>...
> "Giovanni Richmon" <g.richmon(a)yahoo.co.uk> wrote in message <h7rcte$8ho$1(a)fred.mathworks.com>...
> > Dear community,
> >
> > For the given x and y=f(x) values, I would like to obtain b-spline coefficients.
> > How do I obtain these coefficients? I there an easy and fast way to do this with Matlab?
> >
> > Example:
> > N=number of nodes
> > xi=0;
> > xe=pi/2;
> > x=linspace(xi,xe,N);
> > y=sin(x);
> > if quadratic b-splines are constructed, then there must be N+1 coefficents (c) for N nodes
>
> Why N as opposed to N+1? Normally, you have 1 coefficient per node.
>
> > and we have N equations
> > 0.5 c(1)+0.5 c(2)=y(1)
> > 0.5 c(2) +0.5 c(3)=y(2)
> > ...
> > 0.5 c(N) +0.5 c(N+1)=y(N)
> >
> > In addition, it can be considered to add one more equation while considering boundary condition.
> > For exmple: y'(pi/2)=0;
> > so
> > -c(N)+c(N+1)=0 for quadratic case
> >
> > Is there a matlab function to do this consideration for cubic, quadratic b-splines,...?
>
> Why not just derive the equations for the cubic case and solve them... You seem to have done fine for the quadratic case.
>
>