Borrar filtros
Borrar filtros

Summation Evaluation - For incremental Loop Parametres

1 visualización (últimos 30 días)
Sam
Sam el 15 de Feb. de 2014
Editada: Sam el 17 de Feb. de 2014
For the following Summation i am able to evaluate it by hand but the coding in matlab wise i am a little confused as the value of t changes with each iteration i am not able to write i as a normal for loop.
I have a 24x14 Matrix containing X-Data and a 1x14 Matrix containing D-Data
- X represents number of devices and D represents its current usage
- t=24; L=14; (Mathematically t is only true for 3:24 since i need to measure a shift)
Whats happening here is that i am measuring the shift in this 2-Dimensional Matrix from time i till time t (in essence Row i till Row t). Usually t is a fixed number but here, since the value of 't' is varying from 3 till 24 i cannot write this as a normal for loop, as normal for loops will only count from i=1 till i=t but here my t value is also climbing with each iteration. now how could i approach this in matlab? Should i add in a outer for loop to make it 3 for loops?

Respuestas (1)

Roger Stafford
Roger Stafford el 15 de Feb. de 2014
As nearly as I can make out, you are describing the cumulative sum of a matrix product, namely
Value = cumsum(X*D.');
You stated that you are only interested in t varying from 3 to 24, which would mean that you are only interested in the values in 'Value' from its 3rd element to its 24th element.
If this guess is not correct, would you please explain your question in a clearer fashion. Such phrases as "i am measuring the shift in this 2-Dimensional Matrix from time i till time t" need a lot of clarification.

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by