use of dblquad with conditions over the domain of the variables.
1 次查看(过去 30 天)
显示 更早的评论
Good afternoon,
I have the following problem,
Imagine you have 2 normal random variables, x and y, independent from each other. I want to calculate the expected value of x, given that (silly example) x*y is above 0.05.
This requires a double integral over the x and y that satisfy the condition. I tried by
Ex=dblquad(@integrand,-10,10,-10,10);
where, inside the function "integrand" I told matlab that if the condition is satisfied x*y>0.05, take the value of z=x*fx*fy, and if not z=[].
But the code does not work because dblquad does not accept empty vectors arising from "integrand".
Would you have any suggestion? A different approach?
Many thanks, Luis.
2 个评论
Elif
2013-3-11
Hi there,
The way I see it you should explicit the constraints in the call to dblquad.
Rather than writing -10,10 call another function that captures the x and y's you want to use.
Maybe someone else can point out more about this.
Hope it helps.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!