Scilab Function
Last update : 5/5/2008

plq_eval - Piecewise linear quadratic (plq), evaluate a plq function on a grid

Calling Sequence

[y, k] = plq_eval(plqf,X)

Parameters

Description

Evaluates a plq function on a grid. This function is necessary as it allows the plq functions to be simplified into more manageable data with scilab functions such as plotting.

k is a matrix shaped like the following, with a column for each unique piece of the plq function an X value was in. For the i'th unique piece, the values X(L(i):R(i)) were evaluated using the I(i)'th row of the plq function.

        [I(0)    I(1)    ...     I(n-1)  I(n) ]
        [L(0)    L(1)    ...     L(n-1)  L(n) ]
        [R(0)    R(1)    ...     R(n-1)  R(n) ]

Examples

//Example 1
X=[1;2;4;5;7;8;9];
plqf=[3,0.5,0,0;6,0,0,0;%inf,0,1,0];
[y,k] = plq_eval(plqf,X);

//Example 2
x=linspace(0,4)';
plqf = build_plq(x,exp,exp);
y=plq_eval(plqf,x);
  

See Also

plq_function,  

Author

Yves Lucet, University of British Columbia, BC, Canada