Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: for loop ode45 with dynamic variables
Posted:
Dec 5, 2012 7:07 AM
|
|
On 12/4/2012 8:13 PM, Kitech wrote:
>I have looked over the code many many times but I am not sure where the fault is as >the solution comes up as "NaN." I have not shown constants in the code: >
Ok, so debugging is hard. But no one said programming is easy. So you should first do as you have done, which is code inspection, no computers. Make a nice clean print out of the code, have a red pen in you hand, put the listing in front of you, and read the code and make sure it is correct. Think about the logic, see if it all flows as expected, etc...
When this does not help, the next step is to use the debugger.
Make break points, step into the code, until you see the problem show up.
It is hard work, but this is programming. debugging is part of programming, asking someone else to debug your code for you will not help you learn how to do it.
--Nasser
|
|
|
|