Functions to encode a function
Afficher commentaires plus anciens
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.
Réponses (1)
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
Catégories
En savoir plus sur RF Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!