フィルターのクリア

Hoping to find the zero of J0(x) in the interval 0 ≤ x ≤ π, we might try the statement 
 z = fzerotx(@besselj,[0 pi],0)
This is legal usage of a function handle, and of fzerotx, but it produces z = 3.1416. Why? 


3 ビュー (過去 30 日間)
REE BAI
REE BAI 2017 年 9 月 27 日
回答済み: Eeshan Mitra 2017 年 9 月 29 日
if i directly use besselj function, it is display zero at 2.4048
  1 件のコメント
John D'Errico
John D'Errico 2017 年 9 月 27 日
編集済み: John D'Errico 2017 年 9 月 27 日
The question asks you to think. What are the arguments to besselj? If you don't know, why not read the help for besselj? What is fzerotx? (We don't have it, so how can we know?) What do the arguments to fzerotx mean? When you call besselj itself, how did you call it?

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

回答 (1 件)

Eeshan Mitra
Eeshan Mitra 2017 年 9 月 29 日
It depends on how you implement the function "fzerotx" as John points out. I'm assuming it is a custom function you have written to calculate zeros for a (possibly nonlinear) function.
x = 2.4048 is infact a zero which can be validated from the plot in the following code:
X = 0:0.1:pi;
J = besselj(0,X);
plot(X,J,'LineWidth',1.5)
axis([0 pi -1 1])
grid on
To find zeros using the MATLAB function fzero instead, enter the following at the MATLAB Command Window: (Use an initial guess of 3.14 to see if it detects a zero there)
>> fzero(@(X) besselj(0,X),3.14)
ans =
2.4048
If you wish to use your custom function to calculate zeros, it might help to set debug the execution using break points.

カテゴリ

Help Center および File ExchangeSpecial Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by