the loop:
for h=1:t_max
REST OF CODE
end
if t_max is equal to 100, for example, the loop iterates only to 99 or t_max-1.
Anybody can help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Is t_max a computed value? It may be ending up very close to 100 but not quite there, and due to rounding it would display as 100 in the default format setting. Here’s an example using a smaller value of t_max:
Note how t_max looks like it’s 5 when it’s really a shade smaller than 5. In a for loop it would behave like this:
which has the appearance of only iterating to t_max – 1. But bumping up the format, and looking at t_max again will show the value with more precision: