Unmatched Matrix multiplication in Cell Arrays to create reducing count.

4 visualizaciones (últimos 30 días)
Hi,
I have an array of 1000 vectors of rates:
0.006
0.004
0.0029
...
I want to create a decreasing set of values starting from 100,000 which is created by multiplying each output number by the rate 1 step earlier:
1. 100,000
2. 100,000*0.006
3. This value *0.004
etc.
I would like the output to simply be an array of 1000 of these reducing counts, 100,000 ->

Respuesta aceptada

José-Luis
José-Luis el 18 de Ag. de 2012
Assuming your array is called data:
data=[100000;data];
data = cumprod(data);
Cheers!
  3 comentarios
José-Luis
José-Luis el 18 de Ag. de 2012
Editada: José-Luis el 18 de Ag. de 2012
Whats the error that you get? cumprod does what you describe. If you append 100 000 to the beginning of your rates vector, it should work.
For more details:
help cumprod
John
John el 18 de Ag. de 2012
Sorry, my fault!! Answer was perfect!

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 18 de Ag. de 2012
100000 * cumprod( sort(YourRates, 'descend') )

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by