How to find the maximum of mu by solving eqn

1 vue (au cours des 30 derniers jours)
Mikie
Mikie le 25 Oct 2017
Commenté : Mikie le 25 Oct 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)

Réponse acceptée

Reza Bonyadi
Reza Bonyadi le 25 Oct 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?
  1 commentaire
Mikie
Mikie le 25 Oct 2017
Yes. Thank you so much.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by