I am really confused in this code.
Here is what I want to do: Start with a value of "v" 5, do the rest of the functions / calculations, increase the value of "v" by 0.01, perform the functions / calculations, then increase the "v" value by 0.01 again, execute the functions. .. do this 500 times or until the value "v" reaches 10.00, whichever is easier to code.
Here is my code at the moment:
//start loop over v
for(iv=5;iv<=500;iv++) {
v=0.01*iv;
//Lots and lots of calculations with v here
}
Here's what I get: I tried setting iv <= 10, so it only does 10 cycles so that I can check it first before leaving it all night. He performed only 6 cycles, starting with v = 0.05 and ending with 0.1. Thus, the problem is that a) it did not start for 10 cycles, b) it did not start at 5.00, it started at 0.05.
Any help would be greatly appreciated.
EDIT: Holy crap, so many answers! I already tried 2 different answers, both work! I looked at it and changed the code for 3 hours, I can’t believe that it was that simple.
source
share