Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Arithmetic with function(s)

`fn = fncmb(function,operation)`

`f = fncmb(function,function) `

fncmb(function,matrix,function)

fncmb(function,matrix,function,matrix)

f = fncmb(function,op,function)

The intent is to make it easy to carry out the standard linear operations of scaling and adding within a spline space without having to deal explicitly with the relevant parts of the function(s) involved.

returns
(a description of) the function obtained by applying to the values
of the function in `fn = fncmb(function,operation)`

`function`

the operation specified
by `operation`

. The nature of the operation depends
on whether `operation`

is a *scalar*,
a *vector*, a *matrix*, or a *character
vector*, as follows.

| Multiply the function by that scalar. |

| Add that vector to the function's values; this requires the function to be vector-valued. |

| Apply that matrix to the function's coefficients. |

| Apply the function specified by that character vector to the function's coefficients. |

The remaining options only work for *univariate* functions.
See Limitations for more information.

returns (a description of) the pointwise sum of the two functions.
The two functions must be of the same form. This particular case of
just two input arguments is not included in the above table since
it only works for univariate functions.`f = fncmb(function,function) `

`fncmb(function,matrix,function) `

is the same as `fncmb(fncmb(function,matrix),function)`

.

`fncmb(function,matrix,function,matrix) `

is the same as `fncmb((fncmb(function,matrix),fncmb(function,matrix)))`

.

`f = fncmb(function,op,function) `

returns the ppform of the spline obtained by the pointwise combining
of the two functions, as specified by the character vector `op`

. ```
op
can be
```

one of the character vectors `'+'`

, `'-'`

, `'*'`

.
If the second function is to be a constant, it is sufficient simply
to supply here that constant.

`fncmb(fn,3.5)`

multiplies (the coefficients
of) the function in `fn`

by 3.5.

`fncmb(f,3,g,-4)`

returns the linear combination,
with weights 3 and –4, of the function in `f`

and
the function in `g`

.

`fncmb(f,3,g)`

adds 3 times the function in `f`

to
the function in `g`

.

If the function * f* in

`f`

happens
to be scalar-valued, then `f3=fncmb(f,[1;2;3])`

contains
the description of the function whose value at If `f`

describes a surface in R^{3},
i.e., the function in `f`

is 3-vector-valued bivariate,
then `f2 = fncmb(f,[1 0 0;0 0 1])`

describes the
projection of that surface to the (* x*,

The following commands produce the picture of a ... spirochete?

c = rsmak('circle'); fnplt(fncmb(c,diag([1.5,1]))); axis equal, hold on sc = fncmb(c,.4); fnplt(fncmb(sc,-[.2;-.5])) fnplt(fncmb(sc,-[.2,-.5])) hold off, axis off

If `t`

is a knot sequence of length `n+k`

and `a`

is
a matrix with `n`

columns, then `fncmb(spmak(t,eye(n)),a)`

is
the same as `spmak(t,a)`

.

`fncmb(spmak([0:4],1),'+',ppmak([-1 5],[1 -1]))`

is
the piecewise-polynomial with breaks -`1:5`

that,
on the interval [0 .. 4], agrees with the function * x*|→

`fncmb(spmak([0:4],1),'-',0)`

has the same
effect as `fn2fm(spmak([0:4],1),'pp')`

.

Assuming that `sp`

describes the B-form of
a spline of order <`k`

, the output of

fn2fm(fncmb(sp,'+',ppmak(fnbrk(sp,'interv'),zeros(1,k))),'B-')

describes the B-form of the same spline, but with its order raised to `k`

.

`fncmb`

only works for *univariate* functions,
except for the case `fncmb(function,operation)`

,
i.e., when there is just one function in the input.

Further, if two functions are involved, then they must be of
the same type. This means that they must either both be in B-form
or both be in ppform, and, moreover, have the same knots or breaks,
the same order, and the same target. The only exception to this is
the command of the form `fncmb(function,op,function)`

.

The coefficients are extracted (via `fnbrk`

)
and operated on by the specified matrix or operation (and, possibly,
added), then recombined with the rest of the function description
(via `ppmak`

, `spmak,rpmak,rsmak,stmak`

).
To be sure, when the function is rational, the matrix is only applied
to the coefficients of the numerator. Again, if we are to translate
the function values by a given vector and the function is in ppform,
then only the coefficients corresponding to constant terms are so
translated.

If there are two functions input, then they must be of the same
type (see Limitations, below) *except* for the
following.

`fncmb(f1,op,f2)`

returns the ppform of the function

$$x|\to f1(x)\text{}op\text{}f2(x)$$

with `op`

one of `'+', '-'`

,` '*'`

,
and `f1`

, `f2`

of arbitrary polynomial
form. If, in addition, `f2`

is a scalar or vector,
it is taken to be the function that is constantly equal to that scalar
or vector.

Was this topic helpful?