|
"Demetrius Salas" wrote in message <jnvfuq$p3$1@newscl01ah.mathworks.com>...
> I am having a bit of a problem I am attempting to generate a matrix using a pair of while loops and then mesh plot that matrix. For some reason it seems that one of my variables doesn't change along with its increment and I can't for the life of me figure out why. .......
- - - - - - - - - -
Based on what you are showing us, it looks as if you intended 'my2' and 'j' to be reset to [] and 1, respectively, each time the inner while-loop starts, but their initialization is actually outside the outer while-loop where initialization can happen only once. That would cause 'my2' to become longer and longer with each trip through the outer loop. The final 'mz' array would therefore be much wider than you show - I would guess 10 by 100.
What is further puzzling is that the array y2=x.^2+y.^2 seems to already be the matrix you say you are expecting. What is the purpose of the further computation?
Roger Stafford
|