How to find the maximum of mu by solving eqn

1 回表示 (過去 30 日間)
Mikie
Mikie 2017 年 10 月 25 日
コメント済み: Mikie 2017 年 10 月 25 日
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)

採用された回答

Reza Bonyadi
Reza Bonyadi 2017 年 10 月 25 日
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 件のコメント
Mikie
Mikie 2017 年 10 月 25 日
Yes. Thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by