Summation Evaluation for loops shifting purposes
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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. 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?
Basically X number of devices of type j that are shifted from time i to t.
My attempt is as follows... I believe it is still erroneous and needs a little work
for t=3:1:time-1 % time = 24
for L=1:1:14
value(t,L) = x_data(1,k) - x_data(t,L);
value(t,L) = cD1(t,L) * d(1,L);
end
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/156622/image.png)
Many thanks for any advice you could provide me with!
0 Commenti
Risposte (1)
Walter Roberson
il 13 Feb 2014
Using
for l=1:1:t
would be fine. The limits of the inner "for" get re-evaluated each time the "for" is reached by the flow of control from above.
2 Commenti
Walter Roberson
il 13 Feb 2014
I am getting confused because the variable names you are using in your code do not match what is in the diagram.
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!