Summation Evaluation - For incremental Loop Parametres

1 次查看(过去 30 天)
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?

回答(1 个)

Roger Stafford
Roger Stafford 2014-2-15
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.

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by