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.

Respuestas (1)

Voss
Voss el 15 de Dic. de 2022
Editada: Voss el 15 de Dic. de 2022
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

Categorías

Más información sobre RF Toolbox en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 15 de Dic. de 2022

Editada:

el 15 de Dic. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by