Functions to encode a function
Ältere Kommentare anzeigen
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.
Antworten (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
Kategorien
Mehr zu RF Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!