File Exchange

image thumbnail

Phase Portrait Plotter

version 2.2 (291 KB) by Mohit Kumar
Plot the phase portrait for the entered system of differential equations


Updated 28 Mar 2021

View Version History

View License

Install the app into MATLAB and use. Requires basic knowledge of dynamical systems to use and interpret results.

Link to documentation:
Chapter 2 provides a quick overview of the theoretical background.
Chapter 3 contains the user guide and description of features.
Chapter 4 provides some real life examples and phase portraits generated using the app.

The app works with limited functionality for versions preceding R2020b. For versions prior to R2020b, mouse click interactions with the plots (adding trajectories and guessing solutions) do not work. All other functionality is retained.

Shoutout to Ameer Hamza and John D'Errico for their witty answers on MATLAB Answers!

Do comment to share suggestions/bugs and feedback etc. Don't forget to give a positive rating if the app helped you out and would like the app to be discovered by other users!

Cite As

Mohit Kumar (2021). Phase Portrait Plotter (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (19)

Mohit Kumar

Hi Lielle,
I don't understand your first question. Could you detail it a bit more? If you would like to experiment with the code, have a look at the source code present in description's link.
Secondly, to rectify the bug, which version of MATLAB are you using? The tooltip functionality was introduced only in R2016a.

Lielle Stern

Can I use it using my input function that will generate different parameters in the ODE?
Also, I keep getting this Error, so could not use it yet:

No public property Tooltip exists for class

Error in PhasePortraitPlotterApp_DB/createComponents (line
app.BoundaryCheckBox.Tooltip = {'Toggles
trajectories starting from uniform intervals
along the boundary'};

Error in PhasePortraitPlotterApp_DB (line 1432)

Error in PhasePortraitPlotterApp/startApp (line 90)
obj.AppHandle =

Error in PhasePortraitPlotterApp (line 48)

Error in appinstall.internal.runapp>execute (line 78)
out = evalin('caller', [script ';']);

Error in appinstall.internal.runapp>runapp13a (line 57)
outobj = execute(fullfile(appinstalldir, [wrapperfile

Error in appinstall.internal.runapp>runcorrectversion (line
appobj = runapp13a(appinstalldir);

Error in appinstall.internal.runapp (line 18)
out = runcorrectversion(appmetadata, appentrypoint,

Mohit Kumar

That's odd. Do you have the optimization toolbox installed? The optimization toolbox is required to run fsolve, which is used in the code.

Nikita Patel

Hi Mohit
Surprisingly I am using the MATLAB 2020b version!
Which is strange as it should work

Thank you

Mohit Kumar

Hi Nikita,
Could you please let me know which version of MATLAB you are using? I think the error is being caused since your MATLAB version is quite old.
Thanks for pointing this out, I will make the required changes to make it compatible with older version of MATLAB perhaps in a week or two.

Nikita Patel

Hi I installed the app, after adjusting the system I wish to solve and when I click the next button. The following error message occurs in my command window

Error using optimoptions (line 124)
Invalid solver specified. Provide a solver name or handle
(such as 'fmincon' or @fminunc).
Type DOC OPTIMOPTIONS for a list of solvers.

Error in get_all_roots (line 93)

Error in
PhasePortraitPlotterApp_DB/ToFixedPointsButtonPushed (line
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 386)
Error while evaluating Button PrivateButtonPushedFcn.

Am I doing something wrong, or have I installed it wrong?

Mohit Kumar

Thank you for the positive responses and comments.
@Huang Hejun. Currently I have no plans to extend to a 3D phase portrait plotter for two reasons. Firstly, the design and interpretation of a 3D phase portrait will be much much harder. Imagine trying to selectively sift through some selected trajectories from a mesh of lines in 3D. Secondly, I'm not looking to design another app at least as of now.

Huang Hejun

Hi Mohit! Appreciate for your generous work! Do you have considered further work in 3-D phase portrait?

hehe hehe

Nice <h1>Work

Mohit Kumar

@Shiyun Dong. The new version has been updated with the required functionality to edit the plot axes, title and font size. Do let me know if any functionality is missing/buggy.


Mohit Kumar

Hi Shiyun Dong,
Thanks for your kind words :)
I will incorporate the feature of editing the final plot when I find some time, perhaps this weekend (7th-8th March 2020).

Shiyun Dong

Hi, thanks for the amazing work!
I'm wondering if it is possible to change the variables names of 'x-y' to something else. If there is a way to do that, could you please let me know? Thank you very much!

Mohit Kumar

Hi Ignacio,

Thanks for pointing out the bug. The error HAS BEEN FIXED. Please go ahead and download the latest version and let me know if the problem persists.

(The error was caused due to the Enable/Disable property of the ButtonGroup being introduced only in R2020b. Now, I have improved the robustness of the code in general to be better compatible with earlier versions of MATLAB too.)

Hi! It installed but it´s giving this error code. I´m using R2020a version.

Unrecognized property 'Enable' for class 'matlab.ui.container.ButtonGroup'.

Error in PhasePortraitPlotterApp_fixed/createComponents (line 763)
app.FakeMenu.Enable = 'off';

Error in PhasePortraitPlotterApp_fixed (line 1297)

Error in PhasePortraitPlotter_v1App/startApp (line 86)
obj.AppHandle = eval('PhasePortraitPlotterApp_fixed');

Error in PhasePortraitPlotter_v1App (line 48)

Error in appinstall.internal.runapp>execute (line 116)
out = evalin('caller', [script ';']);

Error in appinstall.internal.runapp>runapp13a (line 95)
outobj = execute(fullfile(appinstalldir, [wrapperfile 'App.m']));

Error in appinstall.internal.runapp>preamble18b (line 60)
appobj = runapp13a(appinstalldir);

Error in appinstall.internal.runapp (line 13)
out = preamble18b(appinstalldir);

Error in (line 45)
appinstall.internal.runapp(appName, appLocation);

Mohit Kumar

Hi Sanghdeep and Andrew,
Thank you very much for bringing the issues to my notice. The issue HAS BEEN FIXED and I have uploaded the new version here. Please go ahead and use the new version. Hope you find the app useful. Let me know if the issue persists.
(By the way, the bug causing the crash seems to be very weird. All I had to do to fix the issue was to rename the file.)


I'm getting the same error "Maximum Recursion Limit Reached 500" please help fixing this error.
how could you upload an app having errors that stops on starting itself?

Mohit Kumar

Hi Andrew,
Is that the complete error message that you got?
Ensure that you don't have a function of toChar in your MATLAB path.
As such, those lines are not directly part of the code that I wrote (seems to be some default MATLAB code). I'm not very sure why this is happening. I'm not well-versed with how to deal with this error. If there's more information you can give, I'll try to do what I can. Apart from that, maybe MATLAB answers will be able to help out.

Andrew Dias

I am getting an error when I try to launch the app:
Maximum recursion limit of 500 reached.

Error in opaque/char (line 88)
chr = toChar(opaque_array(1));

Caused by:
Maximum recursion limit of 500 reached.

What does this mean and how do I get around this?

MATLAB Release Compatibility
Created with R2020b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!