フィルターのクリア

Function within an integral

1 回表示 (過去 30 日間)
beginner
beginner 2016 年 3 月 9 日
コメント済み: Star Strider 2016 年 3 月 9 日
Hi,
How can I solve an Integral which looks like:
f(z) = e^A(z)*ln(z), where as A(z) = -z^2
I tried with this code:
fun = @(x) exp(A).*log(x).^2;
A = test_test(x);
q = integral(fun,0,Inf);
function A = test_test(x)
A= -x^2;
end
what am I doing wrong???? PLEASE HELP!!!!!
thanks a lot!!!

採用された回答

Star Strider
Star Strider 2016 年 3 月 9 日
This works for me:
test_test = @(x) -x.^2;
fun = @(x) exp(test_test(x)).*log(x).^2;
q = integral(fun,0,Inf)
q =
1.9475
You have to call your function as ‘test_test(x)’ inside ‘fun’, not as ‘A’. (I created an anonymous function for of ‘test_test(x)’ for convenience. If you are using it as a function file, it would work the same way in ‘fun’.)
  2 件のコメント
beginner
beginner 2016 年 3 月 9 日
Thank you soooo much!!!! you are a genius!!!! <3
Star Strider
Star Strider 2016 年 3 月 9 日
My pleasure!
Thank you!
If my Answer solved your problem, please Accept it!

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by