Summation Evaluation - For incremental Loop Parametres

1 visualizzazione (ultimi 30 giorni)
Sam
Sam il 15 Feb 2014
Modificato: Sam il 17 Feb 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?

Risposte (1)

Roger Stafford
Roger Stafford il 15 Feb 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.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by