www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/cg1dtablegradoperator.m
function A = cg1dtablegradoperator(bpx) %CG1DTABLEGRADOPERATOR Generate gradient operator for 1d tables % % A = CG1DTABLEGRADOPERATOR(XBREAKS) generates a gradient operator % for one dimensional tables. The table is specified by its breakpoints, % XBREAKS. % % See also CGLOOKUPTWO/GRADIENT, CGNORMFUNCTION/GRADIENT, % CGTABGRADCONSTRAINT/PRIVATE/PGEND % Copyright 2006 The MathWorks, Inc. m = length(bpx); dx= diff(bpx); A= zeros((m-1),m); r=1; for c= 2:m % vertical change (not for first row) A(r,c-1:c) = [-1 1]/dx(c-1); r=r+1; end