Develop an M-file for the bisection method. Along with the two initial guesses, pass the function as an argument.
i know how to develop M-file for bisection method but the problem i dont know how to pass the function as argument
ex : 𝒇(𝒙)=𝟓𝒙^3−3x^𝟐+2𝒙−𝟐
how can i make a program that can read that equation as argument ??

 採用された回答

KSSV
KSSV 2020 年 5 月 23 日

0 投票

Read about anonymous functions.
f = @(x) 5*x^3-3*x^2+2*x-2 ;
Any value can be evaluated using:
f(1)
f(2)

2 件のコメント

david carlson
david carlson 2020 年 5 月 23 日
i want to enter the function as [5 -3 2 -2] so matlab can record it as function of x
KSSV
KSSV 2020 年 5 月 24 日
Yes very much possible....when you enter like that, use polyval to evaluate the function at x.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Programming についてさらに検索

製品

リリース

R2016a

質問済み:

2020 年 5 月 23 日

コメント済み:

2020 年 5 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by