How to solve "A and B must be floating-point scalars"?

1 回表示 (過去 30 日間)
Silvio Sapienza
Silvio Sapienza 2020 年 7 月 1 日
コメント済み: Walter Roberson 2020 年 7 月 2 日
Hi! This is my code:
>> syms v w x real
>> j=cos(i*v*x-i*w*sin(x))
j =
cos(v*x*1i - w*sin(x)*1i)
>> J=int(j,0,pi)
J =
int(cos(v*x*1i - w*sin(x)*1i), x, 0, pi)
>> f=w^2*J
f =
w^2*int(cos(v*x*1i - w*sin(x)*1i), x, 0, pi)
>> fh=@f
fh =
function_handle with value:
@f
>> F=integral(fh,w,0,inf)
Error using integral (line 85)
A and B must be floating-point scalars.
I do not understand the meaning of the error. Can anyone help me to solve it, please?

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 7 月 2 日
In a symbolic toolbox, you need to use int() instead of integral to find a symbolic integration. Try following code
syms v w x real
j=cos(1i*v*x-1i*w*sin(x));
J=int(j,0,pi);
f=w^2*J;
F=int(f,w,0,inf);
However, the equation is too complex for MATLAB to find a closed-form solution (or such a solution might not exist).
  1 件のコメント
Walter Roberson
Walter Roberson 2020 年 7 月 2 日
There is an expression for the inner integral; it can be expressed in terms of the AngerJ https://www.maplesoft.com/support/help/maple/view.aspx?path=AngerJ function, or rather longer hypergeometric or MeijerG forms.
However, I do not find a closed form expression for the overall integral.

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by