46 if length(x) ~= length(unique(x))
47 error(
" Have to provide disjoint x locations ");
49 [x, idx] =
sort(x,
" ascend ");
65 cond = sprintf(
" (t>=%g & t <%g) ",xy1(1),xy2(1));
66 a = (xy2(2)-xy1(2))/(xy2(1)-xy1(1));
68 fun = sprintf(
" (%g*t+%g) ",a,b);
69 funs[
k] = [cond
" .* " fun];
70 dfuns[
k] = [cond
" .* " sprintf(
" %g ",a)];
73 dfunstr = sprintf(
" @(t)%s ",
Utils.
implode(dfuns,
" + "));
74 fhandle = eval(funstr);
75 dfhandle = eval(dfunstr);
80 str = sprintf(
" Points: %d ",size(this.
pts,2));
84 function pm =
plot(range) {
87 range = [min(x) max(x)];
89 pm =
plot@general.functions.AFunGen(
this,
" R ", range);
114 p = general.functions.PiecewiseLinear;
116 p = general.functions.PiecewiseLinear(rand(1,7));
118 p = general.functions.PiecewiseLinear(rand(1,7),rand(1,7));
Collection of generally useful functions.
function [ fhandle , dfhandle ] = getFunction()
A MatLab cell array or matrix.
sort
ort the handle objects in any array in ascending or descending order.
function pm = plot(range)
AFUNGEN Summary of this class goes here Detailed explanation goes here.
function [ colvec< double > x , matrix< double > y ] = transform(colvec< double > x,matrix< double > y)
gives the chance for subclasses to manipulate the x,y data before the piecewise nonlinear function is...
PiecewiseLinear(colvec< double > x,matrix< double > y)
static function char str = implode(char|rowvec data,char glue,char format)
Implodes the elements of data using glue.
function str = getConfigStr()
static function test_PiecewiseLinear()