dfield8 with R2015b on Mac OSX issues?

Is there a better option for first order ODE solving/plotting in Matlab than dfield8? It gives me problems every time I attempt to enter differential equations. My latest issue is as follows:
Reference to non-existent field 'axes'.
Error in dfield8 (line 813)
aud = get(dud.axes,'UserData');
Error while evaluating UIControl Callback
Any help or better options would be much appreciated.

5 Comments

Are you referring to the dfield at http://math.rice.edu/~dfield/ ?
Roy, I'm having the same problem. Our DiffEq prof wants us to use dfield8, but it is only compatible up to MATlab 7.7 (R2008b). It seems as though someone must have updated the code in the last 7 years since that was new... and Walter, yes, from the rice website. Do you know of any updated versions?
My errors with the 'newest' version of dfield8 is as follows:
"Error using figure
There is no numb property on the Figure class.
Error in dfield8 (line 258)
dfset = figure('name','dfield8 Setup','numb','off',..."
I found this code, which works but has no GUI or interactive display, you need to enter the equations, limits, and solution curves when calling the .m file:
function dirfield(f,tval,yval)
% dirfield(f, t1:dt:t2, y1:dy:y2)
%
% plot direction field for first order ODE y' = f(t,y)
% using t-values from t1 to t2 with spacing of dt
% using y-values from y1 to t2 with spacing of dy
%
% f is an @ function, or an inline function,
% or the name of an m-file with quotes.
%
% Example: y' = -y^2 + t
% Show direction field for t in [-1,3], y in [-2,2], use
% spacing of .2 for both t and y:
%
% f = @(x,y) y*x
% dirfield(f, -10:.2:10, -10:.2:10)
% hold
% [ts,ys] = ode45(f,[x0,xf],y0)
% plot(ts,ys,'k-')
[tm,ym]=meshgrid(tval,yval);
dt = tval(2) - tval(1);
dy = yval(2) - yval(1);
fv = vectorize(f);
if isa(f,'function_handle')
fv = eval(fv);
end
yp=feval(fv,tm,ym);
s = 1./max(1/dt,abs(yp)./dy)*0.35;
h = ishold;
quiver(tval,yval,s,s.*yp,0,'.r'); hold on;
quiver(tval,yval,-s,-s.*yp,0,'.r');
if h
hold on
else
hold off
end
axis([tval(1)-dt/2,tval(end)+dt/2,yval(1)-dy/2,yval(end)+dy/2])
For R2014b and later, change
dfset = figure('name','dfield8 Setup','numb','off',..."
to
dfset = figure('name','dfield8 Setup','numbertitle','off',..."
It would be a great service if someone were to update dfield, pplane, and odesolve for the latest version of Matlab.
It would be a great service, yes -- but performing the service doesn't pay any bills.

Sign in to comment.

Answers (3)

Errors also arise due to the use of:
if notice
and
if dud.notice
These are corrected by:
if ~isEmpty(notice)
if ~isEmpty(dud.notice)

1 Comment

Hello, very nice answer, but in Matlab R2015a (Windows7): Undefined function '~isEmpty'!
'~isempty' works for me.

Sign in to comment.

ahmed
ahmed on 20 Jun 2016
Edited: ahmed on 20 Jun 2016
you will find the both editions in this link (one for Matlab 2014 and before, the other is for Matlab 2015 and later):
Update: the file of pplane8.m which found in this link works for Matlab 2015 and later :)

2 Comments

pplane8.m DOES NOT WORK for R2015b
go through and replace every occurrence of 'numb' (the quoted string exactly like that) with 'numbertitle'. . Also replace one 'number' (the quotes string exactly like that) with 'numbertitle'

Sign in to comment.

Asked:

on 10 Sep 2015

Answered:

on 17 Feb 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!