Rewriting pplane and dfield
Show older comments
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
on 31 Dec 2020
Roy Goodman
on 10 Jan 2021
Walter Roberson
on 10 Jan 2021
Interruptible
It used to be unique up to 'inter' but another property 'interactions' was added (which I had never noticed before) so there is now a conflict with abbreviating to 'inter'
Roy Goodman
on 11 Jan 2021
Walter Roberson
on 11 Jan 2021
No. The number of new handle graphics properties is huge, with many of the internal ones not well documented (or not documented at all.)
Look for calls to set(), and figure out what kind of object is being worked with. Look up the object properties in the R2014a documentation, and in any case where an abbreviation has been used, fill it out with the full name of the R2014a property.
The only property I can think of at the moment that got a conflicting name as of HG2 is Number vs NumberTitle for figures.
But... if you see calls to set() properties of legend(), or of contour plots, or of colorbar(), then you might need to rewrite the code. It was common to configure properties of all of those based upon the old implementation, but the current implementation is quite different for those, and finding equivalents can be tricky (especially for changing details of exactly how legend entries appear.)
Also, in those days it was still common to use a trailing number in a call to legend() to designate a position for the legend to appear; those got replaced with named locations such as 'east'.
Roy Goodman
on 13 Jan 2021
Star Strider
on 13 Jan 2021
MATLAB is case-sensitive, and 'XData', 'YData', and 'ZData' are properties of the line (or surface) object, not the Axes. If ‘th’ were the handle to the line or surface object, ‘tval’ would likely return numeric values (vector or matrix).
Walter Roberson
on 13 Jan 2021
When you get() then nothing is case sensitive. When you access using struct field notation then that is case sensitive.
Roy Goodman
on 13 Jan 2021
Roy Goodman
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')
[~] = uicontrol('style', 'text', 'string', 'stranger')
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!
