Name

plq_max — Piecewise linear quadratic (plq), Maximum function

Calling Sequence

[plqm, maxf] = plq_max(plqf, plqg)

Parameters

plqf

matrix. One of the plq functions to compute the maximum of.

plqg

matrix. The other plq function to compte the maximum of.

plqm

matrix. A plq function equal to the maximum of plqf and plqg.

maxf

matrix. Specifies the intervals over which each function was the maximum.

Description

<listitem>

Creates a plq function representing the maximum of plqf and plqg for all x values. This function runs in O(m+n) time and returns a plq function containing O(m+n) pieces, where m and n are the number of pieces in plqf and plqg, respectively.

</listitem>

Examples

plqf = [-1,0,-1,-1;%inf,0,1,1];
plqg = [1,0,-1,1;%inf,0,1,-1];
plqm = plq_max(plqf, plqg),
clf(); plq_plotMultiple(-4, 4, plqf, plqg, plqm);

plqf = [%inf,1,0,0];
plqg = [0,0,-3,-1;%inf,0,3,-1];
plqm = plq_max(plqf, plqg),
clf(); plq_plotMultiple(-4, 4, plqf, plqg, plqm);
  

See Also

plq_function

Authors

Bryan Gardiner, University of British Columbia, BC, Canada

Used Functions

plq_oploop is used to iterate over the intervals and construct the maximum.