# Numerical Double Integral in Matlab

조회 수: 3 (최근 30일)
Prerna Mishra . 2022년 9월 22일
댓글: Walter Roberson . 2022년 9월 23일
I have to do the following integration in matlab b is log normally distributed and I have a vector of 100 random number for b call b_rand.
a is a vector of numbers that denotes a Markovian transition probability matrix
[0.1680 0.4098 1.0000 2.4400 5.9537]
I wrote the code as follows, but I am not confident I am doing the right thing. Could someone help?
inner_term = W_t./b
outer_term = a
final_term = inner_term.*outer_term
integral = mean(mean(outer_term)
##### 댓글 수: 8표시 이전 댓글 수: 7숨기기 이전 댓글 수: 7
Walter Roberson 2022년 9월 23일
you will not get the same value, but for a sufficiently dense random sample the value will approach what you would get with a comparably dense uniform grid.

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

### 답변 (1개)

Chunru 2022년 9월 23일
It seems that the integration is separatable into two 1-D integrations:
inner_term = W_t./b
outer_term = a
final_term = inner_term.*outer_term
integral = trapz(b, inner_term) * trapz(a, outer_term)
##### 댓글 수: 1표시 없음숨기기 없음
Prerna Mishra 2022년 9월 23일
It is separable, yes. I will try it out this way.

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

### 카테고리

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!