Filter löschen
Filter löschen

how to find the sum of a function with 2 variables

1 Ansicht (letzte 30 Tage)
Trond Oesten
Trond Oesten am 25 Apr. 2015
Bearbeitet: Sainath Varikuti am 28 Apr. 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)

Akzeptierte Antwort

Sainath Varikuti
Sainath Varikuti am 28 Apr. 2015
Bearbeitet: Sainath Varikuti am 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);

Weitere Antworten (0)

Kategorien

Mehr zu Variables finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by