Azzera filtri
Azzera filtri

use of dblquad with conditions over the domain of the variables.

1 visualizzazione (ultimi 30 giorni)
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 Commenti
Elif
Elif il 11 Mar 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.
Luis
Luis il 11 Mar 2013
Modificato: Luis il 11 Mar 2013
Thanks Elif,
You mean I should do something like
dblquad(@integrand,'lowerlimitx',10,'lowerlimity',1)?
The real problem I have is a double integral where two variables are constrained i.e. x\in(4,10) and y\in(0,1). But there is another constraint because x must also be such that V(x,y)>0 as well as y itself. Does it make sense?

Accedi per commentare.

Risposte (1)

Elif
Elif il 11 Mar 2013
Modificato: Elif il 11 Mar 2013
Ok, so clearly the outer variable depends on the inner variable and viceversa.
I think dblquad is unable in this case to obtain a solution.
You might want to consider a change of variable.

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by