Sum the Product of Two quantities

2 visualizaciones (últimos 30 días)
Shane Kosir
Shane Kosir el 24 de Feb. de 2017
Comentada: Geoff Hayes el 25 de Feb. de 2017
I'm trying to sum (11-x)*poisspdf(x,90/13) from 0 to 11, however when I put the following in matlab it gives me several errors including x = double(x)
sum((11-x)*poisspdf(x,90/13),x,0,11)

Respuestas (1)

Geoff Hayes
Geoff Hayes el 25 de Feb. de 2017
Shane - does x range from 0 to 11? I think that you are trying to use sum to do that but that is not how this function can be used (please see the documentation as to why). What you can try is to do the following
poissDistSum = 0;
for x=0:11
poissDistSum = poissDistSum + poisspdf(x,90/13);
end
I suspect that you could also try the simpler
X = 0:11;
poissDistSum = sum(poisspdf(X,90/13));
  2 comentarios
Walter Roberson
Walter Roberson el 25 de Feb. de 2017
x = 0:11;
sum((11-x).*poisspdf(x,90/13))
Geoff Hayes
Geoff Hayes el 25 de Feb. de 2017
Right! I forgot the (11-x)..

Iniciar sesión para comentar.

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by