Azzera filtri
Azzera filtri

how to find the sum of a function with 2 variables

1 visualizzazione (ultimi 30 giorni)
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)

Risposta accettata

Sainath Varikuti
Sainath Varikuti il 28 Apr 2015
Modificato: Sainath Varikuti il 28 Apr 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);

Più risposte (0)

Categorie

Scopri di più su Variables 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