필터 지우기
필터 지우기

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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by