필터 지우기
필터 지우기

Summation Evaluation - For incremental Loop Parametres

조회 수: 1 (최근 30일)
Sam
Sam 2014년 2월 15일
편집: Sam 2014년 2월 17일
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