フィルターのクリア

Integrating Bessel Function Including for Each Value of Array-Valued Vector

2 ビュー (過去 30 日間)
I'd like to integrate a function which has bessel functions in it for each value of Q.
I've seen that I should use quadv but this will get me a vector of the same length of Q ?
Q = 0:.1:1; z = 0:0.1:20;
h = sin(2*pi*z);
for i = 1:length(Q)
integ = @(z) besseli(0,z).*h.* (Q(i)) ...
./ (h.*(2*besseli(1,z) - h.*besseli(0,z)));
dP(i) = quad(integ,0,1);
end
Thanks.

採用された回答

Walter Roberson
Walter Roberson 2017 年 9 月 21 日
You are using z for two different purposes. In the first line you make z a vector of specific values. In the second line you make h a vector that depends upon those z values. But then in your integ anonymous function, z has become whatever is passed by quad(), which will generally be a vector of variable length. You then try to multiply besseli(0,that vector) by h where h is the vector made up of specific values from the z that had existence outside the function.
Perhaps you need
Q = 0:.1:1; z = 0:0.1:20;
h = @(z) sin(2*pi*z);
for i = 1:length(Q)
integ = @(z) besseli(0,z).*h(z).* (Q(i)) ...
./ (h(z).*(2*besseli(1,z) - h(z).*besseli(0,z)));
dP(i) = quad(integ,0,1);
end
This will give you warning messages about minimum step size reached and possible singularity -- probably due to the singularity that the function has at approximately 0.43
  1 件のコメント
Ezz El-din Abdullah
Ezz El-din Abdullah 2017 年 9 月 21 日
編集済み: Ezz El-din Abdullah 2017 年 9 月 21 日
Thanks. Now, I deleted the vector z and it works fine.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBessel functions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by