program for checking whether the root satisfies an equation

1 回表示 (過去 30 日間)
Sukhversha Luthra
Sukhversha Luthra 2018 年 1 月 2 日
編集済み: Jan 2018 年 1 月 2 日
I am unable to make a program for the following problem.
Suppose I have 5 numbers (eg. 1, 2, 3, 4, 5) and I want to check whether these numbers are the roots of a particular equation(say x^2-7*x+10=0) or not. and I want to pick the numbers (or display the satisfying roots). please help.

採用された回答

Jan
Jan 2018 年 1 月 2 日
編集済み: Jan 2018 年 1 月 2 日
Or without the Symbolic Toolbox
fcn = @(x) x .^ 2 - 7 * x + 10;
x = [1, 2, 3, 4, 5];
f_x = fcn(x)
isroot = abs(f_x < sqrt(eps)); % The limit depends on the equation and actual problem
x(isroot)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by