Multi-dimensional polynomial evaluation

版本 1.0.0.0 (2.7 KB) 作者: Yi Sui
Multi-dimensional polynomial evaluation
512.0 次下载
更新时间 2013/10/29

查看许可证

POLY_ND(order,x,y,z,...) returns the polynomial terms of N variables.
The input can be column vectors of numbers, chars, or symbols.
The terms are orgnized in ascending dimensions.i.e x then x,y then x,y,z.
EXAMPLE 1
syms x,y,z,t
poly_nd(4,x,y)
ans =
[ 1, x, x^2, x^3, x^4, y, x*y, x^2*y, x^3*y, y^2, x*y^2, x^2*y^2, y^3, x*y^3, y^4]

poly_nd(2,x,y,z)
ans =
[ 1, x, x^2, y, x*y, y^2, z, x*z, y*z, z^2]

poly_nd(2,x,y,z,t)
ans =
[ 1, x, x^2, y, x*y, y^2, z, x*z, y*z, z^2, t, t*x, t*y, t*z, t^2]

EXAMPLE 2
x=[0 1 2]'; %numbers vector
y=['y1'; 'y2'; 'y3']; % chars vector
z=sym('z',[1,3]); %symbols vector
poly_nd(2,x,y,z)
ans =
[ 1, 0, 0, y1, 0, y1^2, z1, 0, y1*z1, z1^2]
[ 1, 1, 1, y2, y2, y2^2, z2, z2, y2*z2, z2^2]
[ 1, 2, 4, y3, 2*y3, y3^2, z3, 2*z3, y3*z3, z3^2]

POLYVAL_ND(p,order,x,y,z,...) returns the value of ND polynomial p evaluated at point (x,y,z,...)

e.g for a 3D 2rd order polynomial:
coef: p = [p000 p100 p200 p010 p110 p020 p001 p101 p011 p002 ];
value: v = [ 1, x, x^2, y, x*y, y^2, z, x*z, y*z, z^2] *p'
p is orgnized in ascending dimension.i.e x then x,y then x,y

引用格式

Yi Sui (2024). Multi-dimensional polynomial evaluation (https://www.mathworks.com/matlabcentral/fileexchange/44098-multi-dimensional-polynomial-evaluation), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2013a
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Polynomials 的更多信息
标签 添加标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0