How to find the maximum of mu by solving eqn

1 visualización (últimos 30 días)
Mikie
Mikie el 25 de Oct. de 2017
Comentada: Mikie el 25 de Oct. de 2017
Hi, Can anyone please help me how to do this? Find the maximum of mu by solving eqn. Thank you so much.
sigma = 1;
syms mu
n = 5;
lambda = 1;
U = normrnd(0,1,n,1);
V = normrnd(0,1,n,1);
W = (lambda/sqrt(1+lambda^2))*abs(U) + (1/sqrt(1+lambda^2))*V
W_bar = sum(W)/n
eqn = (W_bar - mu)/sigma == lambda*sum(normpdf(lambda*(W-mu)/sigma)/normcdf(lambda*(W-mu)/sigma));
sol = solve(eqn,mu)

Respuesta aceptada

Reza Bonyadi
Reza Bonyadi el 25 de Oct. de 2017
I think you are after
eqn = ((W_bar - mu)/sigma) - lambda*sum(normpdf(lambda*(W-mu)/sigma)./normcdf(lambda*(W-mu)/sigma))
rather than
eqn = ((W_bar - mu)/sigma) - lambda*sum(normpdf(lambda*(W-mu)/sigma)/normcdf(lambda*(W-mu)/sigma));
and then solve(eqn==0,mu). Note that the first equation returns a unique value while the second is actually a vector.
Does that make sense?

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by