Calculting a function with limits

조회 수: 12 (최근 30일)
Rasmus
Rasmus 2014년 3월 1일
댓글: Rasmus 2014년 3월 2일
Hello guys.
I have a two functions which i need to integrate by using an anonymous function.
but for some reason i says error, first i wanted to use quad, but it seems like it isnt beeing used anymore.
but i think i am misunderstanding something to calculate it.
the two functions are the following:
8/ln(2)*integral(ln(1+tan(x)) lower limit=0 upper limit: pi/4
the next is
integral(2/sqrt(5^2-x^2)) lower limit: 0 upper limit: pi

답변 (2개)

the cyclist
the cyclist 2014년 3월 1일
I suggest the integral function.
  댓글 수: 1
Rasmus
Rasmus 2014년 3월 1일
I tried using the integral(function,lower limit,upper limit)
does not really want to do as i say, can you tell me how you would make it work?

댓글을 달려면 로그인하십시오.


Roger Stafford
Roger Stafford 2014년 3월 2일
Your first integral has a singularity at x = 0, but it was my impression that 'integral' can handle such singularities. However, try setting the lower limit just a tiny bit above zero to see if the trouble remains.
Alternatively you can do integration by parts and solve the equivalent:
8/log(2) * ( pi/4*log(2)-integral( @(x) x/cos(x)/(cos(x)+sin(x)) ,0,pi/4) )
which has no singularity.
As for the second integral, it is a perfectly run-of-the-mill integral which 'integral' should have no trouble with. However, you don't really need matlab to evaluate it. By changing variables x = 5*sin(t), it is easy to show that it is exactly equal to 2*asin(pi/5). Why waste effort setting it up for matlab when ordinary calculus procedures are available?
  댓글 수: 1
Rasmus
Rasmus 2014년 3월 2일
I am taking a class in using matlab, so i have to set it up in matlab. I've already calculated it in hand, i just can't make matlab do it as well. The first one i managed now, but the second is still....

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by