필터 지우기
필터 지우기

Numerical Integration

조회 수: 4 (최근 30일)
Ali Afruzi
Ali Afruzi 2011년 9월 27일
편집: Christine Ak 2013년 10월 12일
I'm trying to calculate numerical integration for below integral:
Numerical Integrate(f(x)*G(x) dx from alpha to beta)
that:
G(x)=Numerical Integrate(g(t) dt from gamma to x)
alpha, beta and gamma are real number, and known. thanks.

채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 9월 27일
a = 1 % eg, input value a
b = 5 % input value b
g1 = 2 % input value g1
f = @(x)x.^2 % input function f
g = @(t)t.^3 % input function g
% solution
gq = @(x)arrayfun(@(x)quad(@(t)g(t),g1,x),x)
yourval = quad(@(x)f(x).*gq(x),a,b)
  댓글 수: 3
Andrei Bobrov
Andrei Bobrov 2011년 9월 27일
Thanks Andrew! I agree with you.
Ali Afruzi
Ali Afruzi 2012년 2월 14일
Thanks so much.

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

추가 답변 (2개)

UJJWAL
UJJWAL 2011년 9월 27일
Hi,
For Integrations and all you have more control and options in the Case of MATHEMATICA. In MATLAB it is possible to perform numerical integrations but the results are generally not as good as u get in MATHEMATICA.
In MATLAB the function you would use to integrate depends upon the kind of algorithm you want to use. There are many algorithms of numerical integrations and depending on that the function to be used would differ. For Simpson's rule we use int while for Gauss-Koncrod we use quadgk. There are other functions like quadl also. So it depends upon the method you want to use. Go through the MATLAB documentation and search for these functions. You will get the best idea. I hope it helps.
HAPPY TO HELP
UJJWAL

Bjorn Gustavsson
Bjorn Gustavsson 2011년 9월 27일
In addition to UJJWAL's suggestions you might benefit much from looking up the Chebfun project: http://www.mathworks.co.uk/matlabcentral/fileexchange/23972-chebfun-version-2
That offers something "halfway between symbolic and numerical" methods. Have been useful to me.
HTH

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by