Vectorize sum of discount rates
Mostrar comentarios más antiguos
Hi,
I want to vectorize the calculation of series like this: [R^0;R^0+R^1;R^0+R^1+R^2;...etc.
Im quite sure this should be easy, but i cant figure it out. Any help is greatly appreciated! :-)
1 comentario
Jan
el 6 de Dic. de 2012
What is "R"?
Respuesta aceptada
Más respuestas (3)
out=1/(1-R).*(1-R.^(1:n));
Jan
el 6 de Dic. de 2012
R = 23;
n = 100;
x = repmat(R, 1, n);
x(1) = 1;
Result = cumsum(cumprod(x));
Sargondjani
el 6 de Dic. de 2012
0 votos
Categorías
Más información sobre Image Arithmetic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!