Multi-dimensional polynomial evaluation
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
Zitieren als
Yi Sui (2024). Multi-dimensional polynomial evaluation (https://www.mathworks.com/matlabcentral/fileexchange/44098-multi-dimensional-polynomial-evaluation), MATLAB Central File Exchange. Abgerufen.
Kompatibilität der MATLAB-Version
Plattform-Kompatibilität
Windows macOS LinuxKategorien
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Live Editor erkunden
Erstellen Sie Skripte mit Code, Ausgabe und formatiertem Text in einem einzigen ausführbaren Dokument.
Version | Veröffentlicht | Versionshinweise | |
---|---|---|---|
1.0.0.0 |