Dear All:
I am using web version MatLab to try to draw direction field for 1st order differential equation by using quiver function. Sometimes the direction field was successfully plotted, but sometimes failed, with warning message: "Warning: Matrix is singular to working precision".
For example, this code below susscessfully plotted the direction field of DE(y'=y^2):
% y'=y^2
[T, Y]=meshgrid(-2:0.2:2, -3:0.5:3)S=Y.^2;L=sqrt(1+S.^2);quiver(T, Y, 1./L, S./L, 0.3), axis tightxlabel 't', ylabel 'y'title 'Direction Field for dy/dt = y^2'
However, this code failed when I tryied to plot y'=t^2/(1-y^2):
% y'=t^2/(1-y^2)
[T, Y]=meshgrid(-3:0.1:3, -3:0.1:3)S=T.^2/(1. - Y.^2);L=sqrt(1+S.^2);quiver(T, Y, 1./L, S./L, 0.3), axis tightxlabel 't', ylabel 'y'title 'Direction Field for dy/dt = t^2/(1-y^2)'
Ths plot is blank, with message: "Warning: Matrix is singular to working precision". The expected direction field is attached as a picture.
Thank you very much for your help. I greatly appreciate it.
Best Answer