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!