How to calculate the (odd ,even) condition in the following Poisson distribution for p_z parameter? i need some help in the code bellow

1 回表示 (過去 30 日間)
Sofy
Sofy 2019 年 7 月 12 日
コメント済み: Rik 2019 年 7 月 15 日
when q=[0.1,0.2,0.3,0.4,0.5] and p =1-q, z=6
  6 件のコメント
Torsten
Torsten 2019 年 7 月 12 日
And what are q_1, p_1, q_2, p_2 ? In your case q_1 = 0.1, p_1 = 0.9, q_2 = 0.2, p_2 = 0.8 ?

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

回答 (1 件)

Torsten
Torsten 2019 年 7 月 12 日
編集済み: Torsten 2019 年 7 月 12 日
function main
p1 = 0.9;
p2 = 0.8;
q1 = 1-p1;
q2 = 1-p2;
z = 6;
vec = zeros(1,z);
vec(1:2:end) = q1/p1;
vec(2:2:end) = q2/p2;
lambda = sum(vec);
terms_right = [1-fliplr(cumprod(vec)), 0];
terms_left = lambda.^(0:z)./factorial(0:z);
P_z = 1 - exp(-lambda)*sum(terms_left.*terms_right)
end

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by