random number estimate value

Hi
In this problem I know that for a=0.5 q=125. I try fo find that now I don't know a value but I know q. How can I estimate a value and use random command for a value.
a =rand(); % estimate number
b = 0.1;
fun = @(x,y) a*x.^2 + b*y.^2;
q = integral2(fun,0,5,-5,0) % real value 125

 Respuesta aceptada

Star Strider
Star Strider el 12 de En. de 2019

0 votos

Try this:
b = 0.1;
fun = @(x,y,a,b) a*x.^2 + b*y.^2;
q_fcn = @(a) integral2(@(x,y)fun(x,y,a,b),0,5,-5,0) % real value 125
a = fzero(@(a)q_fcn(a) - 125, 1)
producing:
a =
0.5
This solves for ‘a’ given ‘b’, ‘q’ and the limits of integration.

Más respuestas (1)

erhan aksu
erhan aksu el 13 de En. de 2019

0 votos

Thanks Star Strider

Categorías

Más información sobre Random Number Generation en Centro de ayuda y File Exchange.

Preguntada:

el 12 de En. de 2019

Comentada:

el 13 de En. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by