What are some tips for debugging MATLAB plots?

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
saravanan13
Messages
52
Reaction score
0
Dear friends
I M. Saravanan, currently working in MATLAB attempting to plot some solutions of the differential equations.
When plotting I received a command "Warning: Matrix is singular to working precision" for the solution step in the M files. Since as a beginner this statement make me to proceed further.
The solution involves a lot of parameter so that by tuning the parameter I could get the plot.

Also another command which I received is "Nan".

I could be benefit enough if someone could be help me in this regard.
 
Physics news on Phys.org
The warning tells you that you probably divided by zero somewhere (or did another similar operation). The NaN (not a number, and not the delicious naan bread) you see in your results is confirmation of this. I'd suggest using the debugging features to set some breakpoints, or step through your m-file and debug your code:
http://www.mathworks.com/help/techdoc/matlab_env/brqxeeu-175.html
http://en.wikibooks.org/wiki/MATLAB_Programming/Debugging_M_Files
 
Last edited by a moderator: