0001 function eval = bivariatePolynomialEval(coeffs, x, y)
0002
0003
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 numCoeffs = numel(coeffs);
0013 if numCoeffs == 0
0014 eval = zeros(size(x));
0015 return
0016 end
0017
0018
0019 switch numCoeffs
0020 case 1
0021 degree = 0;
0022 case 3
0023 degree = 1;
0024 case 6
0025 degree = 2;
0026 case 10
0027 degree = 3;
0028 otherwise
0029 error('Polynomial degree not implemented');
0030 end
0031
0032
0033 terms = bivariatePolynomialTerms(degree, x, y);
0034
0035
0036 eval = terms*coeffs;
0037
0038 end
0039