I think your problem is with what you call this statement. This is not an iteration, but a simple task. Now we only need to understand what was assigned.
I assume that j
, k
, w
are all vectors 1
on N
j(1:5)
- means elements from 1
to 5
vector j
j(1:5) + k(1:5)
- will result in an elementary sum of both operands w(1:5) = ...
- again assign the result as before w
Writing code using a colon notation makes it less verbose and more efficient. Therefore, it is highly recommended that you do this. In addition, the colon designation is the core and very powerful MATLAB function. Make sure you understand this well before moving on. MATLAB is very well documented, so you can read it here .
source share