Need to find x intercepts Using Matlab

Hi,
I have the following function and I am supposed to find the # of x intersects within the domain of [-20, 5].
3*x^2-1 = exp(-0.5*x)
I have the following commands typed into my script.
func = inline('3*x^2-1-exp(-0.5*x)')
fzero(func,[-20,5])
I am getting only 1 value showing me the x intercept but i am sure there are more than 1 intercepts.
How can i find all the x Intercepts.
PLEASE HELP...!!

1 件のコメント

Soliver Fusi
Soliver Fusi 2015 年 10 月 16 日
編集済み: Soliver Fusi 2015 年 10 月 16 日
fsolve: fzero I think only works for one point

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

 採用された回答

Walter Roberson
Walter Roberson 2013 年 10 月 2 日

0 投票

fzero() only calculates one intercept.
Plot the function and use the result to divide the distance between [-20, 5] into as many sub-ranges as necessary, each containing one intercept. Then fzero() over each of those sub-ranges.

4 件のコメント

Ravi
Ravi 2013 年 10 月 2 日
I actually figured this out and I have already done it that way using -20,-10 -10,0 0,5. I was wondering if there is one command which will give all three intercepts using one range.
Thank you very much for taking time to respond.
Walter Roberson
Walter Roberson 2013 年 10 月 2 日
No, there is no command that can be given an arbitrary function and will return all of its zeros. There is a contribution from Roger Stafford in the File Exchange that tries to return multiple roots.
Ravi
Ravi 2013 年 10 月 2 日
Thank you very much.
Walter Roberson
Walter Roberson 2013 年 10 月 2 日
Note: returning all zeros of an arbitrary function is a theoretical impossibility.

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

その他の回答 (0 件)

カテゴリ

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

質問済み:

2013 年 10 月 1 日

編集済み:

2015 年 10 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by