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 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
Walter Roberson
on 25 Dec 2017
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 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!