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 vue (au cours des 30 derniers jours)
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

Réponse acceptée

Walter Roberson
Walter Roberson le 25 Déc 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)

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by