i got some issues trying to integrate a function symbolically

1 回表示 (過去 30 日間)
Randy Chen
Randy Chen 2020 年 11 月 14 日
コメント済み: Ameer Hamza 2020 年 11 月 14 日
I'm trying to symbolically integrate this function, but it's not working:
>> syms x y s
>> fun = y/((x-s)^2+y^2);
>> int(fun,s,-l/2,l/2)
ans =
int(y/((s - x)^2 + y^2), s, -l/2, l/2)
why does matlab return me an expression the same as what I typed????? I want an integral in symbolic form instead. The function is to be integrated with respect to variable s only from -l/2 to +l/2 (lower case L)

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 11 月 14 日
編集済み: Ameer Hamza 2020 年 11 月 14 日
For a general case, the solution might not be expressed in an analytical form. But if x and y are assumed to be real, then you can get an expression
syms x y s l
assume([x y], 'real')
fun = y/((x-s)^2+y^2);
I = int(fun,s,-l/2,l/2)
Result
>> I
I =
atan((l - 2*x)/(2*y)) + atan((l + 2*x)/(2*y))
  5 件のコメント
Randy Chen
Randy Chen 2020 年 11 月 14 日
thank you!
Ameer Hamza
Ameer Hamza 2020 年 11 月 14 日
I am glad to be of help!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConversion Between Symbolic and Numeric についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by