Rewriting pplane and dfield

30 views (last 30 days)
Roy Goodman
Roy Goodman on 30 Dec 2020
Commented: Jiro Doke on 22 May 2021
This is not quite a question in the usual MATLAB Answers sense, but I am hoping that someone who looks at MATLAB Answers might be able to help. I apologize in advance for the length of this submission. Other people have written to MATLAB Answers with similar questions, but none have really arrived at a satisfactory conclusions.
There is a pair of free third-party MATLAB programs for drawing direction fields and phase planes, written many years ago by John Polking and available here:
These were last updated 15 years or so ago and have not worked on any recent releases of MATLAB.
This is a real shame, as these programs are very useful for helping students to understand these important tools for analyzing ODE. Many college and university math departments use MATLAB throughout their curriculum, and these programs were a good tool for a sophomore-level math class. I used to assign them to my own classes.
There have been a number of attempts to re-create the functionality of these programs, including a Java version, an iOS replacement, a Python replacement, and a partial rewrite of the code in MATLAB. None of them work as well as pplane and dfield. So now, instead of being able to simply assign one MATLAB program, I maintain a webpage weighing the pros and cons of each replacement and telling the students to pick one: https://web.njit.edu/~goodman/courses/math222/matlabinformation/
I have found on File Exchange a number of attempts to revive this program. None of them work 100% on my Mac installation of MATLAB R2020b.
I really would like to be able to get these programs running again, but have no idea where to begin. The codes are a mess, each about 7000 lines and not even separated into functions! Plus I have no experience with GUI programming.
I think that having such a program would be very good for Mathworks, as many students first encounter MATLAB in lower-division undergraduate classes, and I often hear them complaining about the experience. Making this experience smooth might convince them that MATLAB is worth using in the future.
So, my queston: Can anybody inside or outside Mathworks help me get these programs running again at full capacity? Ideally I would like to modernize them, modularize the code, make it maintainable, and take advantage of 15 years worth of advances in MATLAB, especially the improved graphics.
  12 Comments
Roy Goodman
Roy Goodman on 26 Jan 2021
Still working on this code. It contains many calls like this
dwindow = uicontrol('style','text',...
'pos',[eqleft winbot1 disfrw-10 texth],...
'horizon','center',...
'string','The display window.','visible','off');
These assign the result of a uicontrol command to a variable. These variables are almost never called again, so the Code Analyzer reports gives me value assigned may be unused warnings. Is it safe to call uicontrol without assigning the result to a variable?
Walter Roberson
Walter Roberson on 26 Jan 2021
Yes, it is safe to call uicontrol without assigning the result to a variable.
For R2009b and later (I think it was, maybe R2009a) you can also use [~] as the output if you are worried about side effects not happening. This can make a difference for legend() calls: legend() with zero or one outputs uses different internal representation than legend with two or more outputs.
a = uicontrol('style', 'text', 'string', 'hello')
a =
UIControl (hello) with properties: Style: 'text' String: 'hello' BackgroundColor: [0.9400 0.9400 0.9400] Callback: '' Value: 0 Position: [20 20 60 20] Units: 'pixels' Show all properties
[~] = uicontrol('style', 'text', 'string', 'stranger')

Sign in to comment.

Accepted Answer

Jiro Doke
Jiro Doke on 21 May 2021
You may want to try the newly "recreated" Phase Plane and Slope Field Apps.
It says it requires R2021a or later.
  2 Comments
Roy Goodman
Roy Goodman on 21 May 2021
Thanks, Jiro. I know it! I've actually been beta-testing the new programs for Brian.
Jiro Doke
Jiro Doke on 22 May 2021
Excellent! Thanks for beta testing!

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!