hello i am asking about how to solve this error? ..Note that input : q=[0.1,0.2,0.3,0.4,0.5] and z=[0,1,2,3,4]
1 回表示 (過去 30 日間)
古いコメントを表示
function y=c(q,z)
p=1-q;
lambda=z.*q./p;
sum=1;
for k=0:max(z)
poisson=exp(-lambda);
for i=1:k
poisson=poisson.*lambda./i;
end
sum=sum-poisson.*(1-((q/p).^(z-k)));
end
y=array2table(sum);
end
0 件のコメント
採用された回答
Walter Roberson
2017 年 12 月 25 日
You are asking to do element by element multiplication of a 5 x 1 vector and a 1 x 5 vector. For the .* operator, the array sizes must be the same or one of them needs to be a scalar, unless you are using R2016b or later (which we can deduce you are not using)
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!