Integral of a gaussian function wrong answer
4 ビュー (過去 30 日間)
古いコメントを表示
Matthias Freiherr von Andrian-Werburg
2017 年 7 月 12 日
編集済み: Karan Gill
2017 年 10 月 17 日
I am trying to calculate the integral of the following Gaussian function:
syms x A
assume(x,'real');
assume(A,'real');
assumeAlso(A>0);
% Expression to integrate
eq = x^14*exp(-x^2/2)*exp(-A*x);
% Integration
ans = int(eq,x,-inf,inf)
Matlab gives me an answer containing hypergeo and erf. However, there is a regular algebraic solution without the needs of hypergeo or erf. (For example type "integral of (x^14*exp(-x^2/2)*exp(-A*x)) from -inf to inf" into wolfram alpha to get algebraic solution)
Is there a way to get to the algebraic answer in Matlab?
0 件のコメント
採用された回答
Karan Gill
2017 年 7 月 12 日
I could get the algebraic answer but it required calling "simplify" twice. Need to investigate this further.
>> syms x A
assume(x,'real');
assume(A,'real');
assumeAlso(A>0);
% Expression to integrate
eq = x^14*exp(-x^2/2)*exp(-A*x);
sol = int(eq,x,-Inf,Inf); % long expression
>> sol1 = simplify(sol,'Steps',500); % first simplify step
>> sol2 = simplify(sol1,'Steps',200) % second simplify step
sol2 =
2^(1/2)*pi^(1/2)*exp(A^2/2)*(A^14 + 91*A^12 + 3003*A^10 + 45045*A^8 + 315315*A^6 + 945945*A^4 + 945945*A^2 + 135135)
3 件のコメント
Karan Gill
2017 年 7 月 12 日
編集済み: Karan Gill
2017 年 10 月 17 日
You can find the option in 4th example under simplify here. If the example is hard to find or read, that would be useful to know. Unfortunately, sometimes these options do get lost in longer doc pages.
Thanks,
Karan (Symbolic doc)
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!