Functions to encode a function

i need help writing a functino to encode the function f(x)=a+bx+cx2 +dx3 +ex4 +fx5 +gx6 +hx7 for part of my code where a=3, b=0, c=0 d=0, e=6, f=4, g=1, h=8 but im not sure how.

回答(1 个)

Voss
Voss 2022-12-15
编辑:Voss 2022-12-15
Not sure exactly what you mean, but [h g f e d c b a] encodes the function f(x) (for use in polyval, for instance).
a=3; b=0; c=0; d=0; e=6; f=4; g=1; h=8;
x = [1 2];
f_of_x = polyval([h g f e d c b a],x) % evaluate f(x) at x = 1 and x = 2
f_of_x = 1×2
22 1315

类别

帮助中心File Exchange 中查找有关 RF Toolbox 的更多信息

标签

提问:

2022-12-15

编辑:

2022-12-15

Community Treasure Hunt

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

Start Hunting!

Translated by