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 日

0 投票

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 ExchangeRF 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