MATLAB What are some tips for debugging MATLAB plots?

AI Thread Summary
When debugging MATLAB plots, a common issue is encountering the warning "Matrix is singular to working precision," which indicates potential division by zero or similar errors. This can lead to NaN (not a number) results in the output. To resolve these issues, it's recommended to tune parameters carefully and utilize MATLAB's debugging features, such as setting breakpoints and stepping through the code. Resources like the MATLAB documentation and Wikibooks provide helpful guidance on effective debugging techniques. Proper debugging can significantly improve the accuracy of plots generated from differential equation solutions.
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:

Similar threads

Back
Top