how to find the sum of a function with 2 variables

1 visualización (últimos 30 días)
Trond Oesten
Trond Oesten el 25 de Abr. de 2015
Editada: Sainath Varikuti el 28 de Abr. de 2015
Hi,
I'm trying to find the sum of the function likelihhod, after the values from smaller is inserted. Then I want to integrate the new function for the variables d1 and d2 with the limits given bellow. But when I try this approche it only crashes. Can anyone tell me how I can do this?? Thanks!
smaller = [1650,1660,1656,1649];
m = numel(smaller);
q = 1657;
likelihood = @(d1,d2) sum(log((d2./d1).*(smaller./d1).^(d2-1).*...
exp(-(smaller./d1).^d2)))+ log(exp(-(q/d1)^d2);
integration = integral2(@d1,d2)likelihood(d1,d2),1000,2000,30,230)

Respuesta aceptada

Sainath Varikuti
Sainath Varikuti el 28 de Abr. de 2015
Editada: Sainath Varikuti el 28 de Abr. de 2015
I would break down the likelihood expression into smaller expressions in order to narrow down on the error. For example
a = @(d1,d2) (d2/d1)*(smaller./d1)
b = @(d1,d2) (d2-1)*exp(-(smaller./d1).^d2);
x = @(d1,d2) log(a(d1,d2).^b(d1,d2));
y = @(d1,d2) (exp(-(q/d1)^d2));
likelihood = @(d1,d2) sum(x(d1,d2))+y(d1,d2);
integration = integral2(likelihood,1000,2000,30,230);

Más respuestas (0)

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by