Scilab Data Type
Last update : 11/08/2008

plq_function - Piecewise linear quadratic (plq) function description

Description

A plq function is a piecewise function, where each piece is either a linear or a quadratic polynomial. It is stored as a matrix, where each row represents one piece of the function.


Typical plq matrix 

        [x(1)    a(1)    b(1)    c(1) ]      f(x) = a(1)*x^2 + b(1)*x + c(1), if -%inf < x <= x(1)
        [x(2)    a(2)    b(2)    c(2) ]      f(x) = a(2)*x^2 + b(2)*x + c(2), if x(1) < x <= x(2)
        [ '        '       '       '  ]       '           '            '            '           '
        [ '        '       '       '  ]       '           '            '            '           '
        [x(n-1)  a(n-1)  b(n-1) c(n-1)]      f(x) = a(n-1)*x^2 + b(n-1)*x + c(n-1), if x(n-2) < x <= x(n-1)
        [%inf    a(n)    b(n)   c(n)  ]      f(x) = a(n)*x^2 + b(n)*x + c(n), if x(n-1) < x <= %inf

Where 

'x' is where the domain is defined
'a' is the quadratic term
'b' is the linear term
'c' is the constant term

And a typical row is  a(i)*x^2 + b(i)*x + c(i) if x(i-1) < x <= x(i).

Note that singleton indicator functions are given in a special form such that [x(1),0,0,c(1)] = I[x=x(1)] + c(1).

Examples

plqAbs = [0,0,-1,0;%inf,0,1,0]; // The function y = |x|
plqQuad = [%inf,1/5,-4/5,4/5];  // The function y = (x-2)^2 / 5 = (x^2 - 4*x + 4) / 5
plq_plot(plqAbs, plqQuad);      // Plot the functions together
  

See Also

plq_add,  plq_build,  plq_clean,  plq_co,  plq_eval,  plq_lft,  plq_me,  plq_me_max_scale,  plq_pa,  plq_pa_mu,  plq_plot,  plq_plot2,  plq_plotpa,  plq_plotpa_lambdaSet,  plq_plotpa_muSet,  plq_proj,  plq_scalar,  

Author

Bryan Gardiner, University of British Columbia, BC, Canada