How to find zeros of a function?
古いコメントを表示
For instance,
x = -3.55:0.1:3.55;
y = x.^2 - 4;
Obviously, when x=2 or -2, y=0.
But I want to know how to use matlab to find zeros of a function y = f(x) when x is a matrix defined by the user like the above case.
3 件のコメント
Mark Sherstan
2018 年 12 月 17 日
Akira Agata
2018 年 12 月 17 日
If your function is always polynomial, you can use roots function to do this task. Please look at the following help page.
回答 (3 件)
Wenjie
2018 年 12 月 17 日
3 件のコメント
Walter Roberson
2018 年 12 月 17 日
However this is not suitable for the case where x is a matrix like you asked in your Question.
fzero() itself is also not suitable for the case where you have an array-valued (probably multivariate) function: you need fsolve() from the Optimization Toolbox for that.
Nico
2024 年 2 月 25 日
What does the @(x) and the 3 mean? Sorry I'm university student with no experience...
Dyuman Joshi
2024 年 2 月 25 日
編集済み: Dyuman Joshi
2024 年 2 月 25 日
Walter Roberson
2018 年 12 月 17 日
0 投票
x(y==0)
Note that this can miss an indefinite number of zeroes of a function if the x do not happen to sample at the right places . It also will not detect zero crossings between x values . You could make use of the results to get hints about zero crossings .
カテゴリ
ヘルプ センター および File Exchange で Mathematics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!