bivariatePolynomialTerms

PURPOSE ^

BIVARIATEPOLYTERMS Get the terms of a bivariate polynomial function of a

SYNOPSIS ^

function terms = bivariatePolynomialTerms(degree, x, y)

DESCRIPTION ^

BIVARIATEPOLYTERMS Get the terms of a bivariate polynomial function of a
 given degree

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function terms = bivariatePolynomialTerms(degree, x, y)
0002 %BIVARIATEPOLYTERMS Get the terms of a bivariate polynomial function of a
0003 % given degree
0004 
0005 if size(x, 2) ~= 1
0006     error('X and Y must be column vectors');
0007 end
0008 if size(x) ~= size(y)
0009     error('Sizes of ''x'' and ''y'' must be the same');
0010 end
0011 
0012 switch degree
0013     case 0
0014         terms = ones(size(x)); % Constant
0015     case 1
0016         terms = [x y ones(size(x))]; % Linear
0017     case 2
0018         terms = [x.*x, y.*y, x.*y, x, y, ones(size(x))]; % Quadratic
0019     case 3
0020         terms = [x.*x.*x, y.*y.*y, x.*x.*y, x.*y.*y, x.*x, y.*y, x.*y, x, y, ones(size(x))]; % Cubic
0021     otherwise
0022 %         error('Polynomial degree not implemented');
0023         terms = []; % Smaller than one or not implemented
0024 end
0025         
0026     
0027 
0028 end
0029

Generated on Thu 10-Dec-2020 17:34:27 by m2html © 2005