nodetype: node type, one of 'gaussian' (default), 'endpoint', or 'lobatto'

varname: string, variable name. Defaults to 'V0'

If no inputs are provided (needed to preallocate array of basis)

if nargin ==0
B.n = 3;
B.a = -1;
B.b = 1;
returnend

SET PROPERTIES

B.n = n;
B.a = a;
B.b = b;

Set nodetype

if nargin > 3 && ~isempty(nodetype)
B.nodetype = lower(nodetype);
end

Set variable name

if nargin==5
B.varname = varname;
end

Check validity of inputs and set nodes

B.CheckValidity;
B.SetNodes;
end%basisChebyshev1

copy

function Bcopy = copy(B)

Bcopy = B.copy

Makes a (value) copy of basis B. Since class basisChebyshev is a handle, in this example

B2 = B;
B3 = B.copy;

B2.a = 0;
B3.n = 9;

the line B2.a = 0 sets the lower limit a to zero in both B2 and B (B2 is just a pointer to B), whereas the line B3.n = 9 does not modify B (on assignment, B3 is simply a copy of B, not a pointer to B).

Bcopy = basisChebyshev(B.n,B.a,B.b,B.nodetype, B.varname);
end

checkValidity

function CheckValidity(B)

B.CheckValidity

Checks the consistency of some basis B parameters. Called by constructor to ensure the following conditions :

Evaluate

Evaluates the interpolated functions defined by basis B and coefficients coef. Inputs x, order and integrate are as required by Interpolation method, while coef is a n.m matrix (n basis functions and m interpolated functions)

Output y returns the interpolated functions as a k.m.h array, where k is the number of evaluation points, m the number of functions (number of columns in coef), and h is number of order derivatives.

Reset

function Reset(B)

Following a change in the basis definition, the nodes must be recomputed and the fields D and I are no longer valid. This method is called by the setter methods, so the user does not need to call it explicitly.

B.CheckValidity;
B.SetNodes;
B.I = [];
B.D = [];
end

Setter methods

The following setter methods allow changing the basis definition (parameters n,a,b,nodetype). Changes to these parameters require recomputing the nodes and deleting the operators D and I.