use of dblquad with conditions over the domain of the variables.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Elif
el 11 de Mzo. de 2013
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.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!