Numerical Double Integral in Matlab

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 Comments

b being log-normally distributed is not compatible with doing an integration with respect to db .
If you have sufficient specific b values then potentially you could do an approximation of the integral using trapz()
Prerna Mishra
Prerna Mishra on 22 Sep 2022
Edited: Prerna Mishra on 22 Sep 2022
I have a vector of 100 values for b:
1.8352
1.4867
1.5380
2.3116
1.2344
3.0172
1.1257
0.6769
2.3303
3.0776
2.6294
2.3909
0.6308
1.5471
1.5040
2.0812
1.7468
1.6081
1.5864
2.7595
1.9314
2.9608
2.8772
2.5619
4.0533
5.7075
1.3209
3.0450
1.2633
2.8767
2.1860
1.5720
0.7313
3.5476
1.4644
2.7337
2.0794
1.1249
0.7128
1.5698
2.9628
0.7943
1.5670
1.5715
1.4503
0.9092
1.9785
2.2779
1.7367
2.7557
3.3738
1.0204
4.4439
1.7279
4.4764
0.6940
3.0422
2.4732
1.8714
1.3300
3.0580
1.2416
2.8013
0.8385
4.4282
1.9283
1.1553
0.7967
2.5670
5.5474
1.1477
1.8341
2.0979
2.8339
1.2942
1.6179
2.9810
1.6754
1.6775
2.7661
1.4816
1.3977
1.0378
1.0305
3.1925
2.0005
1.3732
0.8174
0.9816
1.9778
2.0038
0.7942
3.0344
2.4299
2.0695
2.5443
2.1619
1.1240
3.8042
1.2711
Would I need to make a nested call to trapz?
Do you have a link on how to evaluate stochastic integrals ? Not with trapz - that's for sure.
@Torsten Not sure what you mean by link.
Torsten
Torsten on 23 Sep 2022
Edited: Torsten on 23 Sep 2022
I mean if you know of a numerical method on how to evaluate stochastic integrals and if you know a web page where this is explained.
No, I dont know. If I have a sufficiently long vector of log normally distributed random variables, it is possible to use the trapeziod rule, i.e say if I have a vector of 100 variables with the lbounds being the lowest and highest value in the vector.
Torsten
Torsten on 23 Sep 2022
Edited: Torsten on 23 Sep 2022
If I have a sufficiently long vector of log normally distributed random variables, it is possible to use the trapeziod rule, i.e say if I have a vector of 100 variables with the lbounds being the lowest and highest value in the vector.
Sorry, but this is nonsense. How does the fact that the values for b are generated from a lognormal distribution influence the integral ? b is the independent, not the dependent variable. If you use the trapezoidal rule, you will get the same value as if you use a uniform grid between b_l and b_h.
And how can you Markovian transition probability matrix have values greater than 1 ?
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.

Sign in to comment.

Answers (1)

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 Comment

It is separable, yes. I will try it out this way.

Sign in to comment.

Asked:

on 22 Sep 2022

Commented:

on 23 Sep 2022

Community Treasure Hunt

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

Start Hunting!