Why is my iteration not working?
10 Comments
You have i-1 in both places on the right side here:
u(j,:,i) = LatPos(j,:,i-1) - LatPos(j,:,i-1);
So that's subtracting something from itself, which will result in zeros (unless the something is NaN or infinity).
The original code had i and i-1. Should it be i and i-1? If so, check/change it and see if that gives you some non-zero values.
There are also a lot of missing close parentheses on lines like this one:
for i = 2:numel(u(1,:,:) % <- missing ")"
I don't know if that's because of an error/artifact of copy-pasting to here or if that's missing in your real code, but in general it's necessary for us to have the actual code you're running, so please check those places too.
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
