I don't know this code well, but inspecting it, it's true that I find that
h = h - dh;
is the first occurance of dh anywhere.
So in terms of literally tracing through the code in the order in which it appears, dh hasn't been defined at this point. However, _in terms of code execution_, that doesn't necessarily matter. You'll notice that this line occurs within two nestated loops, and that its immediate surroundings is a conditional:
if min(real(eig(full(C)))) < 0
Presumably the order of execution (looping, branching etc) prevents the variables you mention from ever being undefined.
I don't have the time to trace through it myself. :-) It would be quickest, perhaps, to set some breakpoints and run through an example with the matlab debugger instead of trying to trace through it with the code only.
|