When using ode45, have Error using odeget Unrecognized property name 'NonNegative'. See ODESET for possibilities.

I was using ode45 with 'options' defined as:
options = odeset('RelTol',1e-10,'AbsTol',1e-10);
[t1,y1] = ode45(@(t,y)disc_dy(t,y,delta,g,C,N,F,H),tspan,y0,options);
When tried to run the code above, errors pop up as follows:
Error using odeget
Unrecognized property name 'NonNegative'. See ODESET for possibilities.
Error in ode45 (line 158)
idxNonNegative = odeget(options,'NonNegative',[]);
Error in simulation (line 122)
[~,y1] = ode45(@(t,y)disc_dy(t,y,delta,g,C,N,F,H),tspan,y0,options);
These codes worked well in ver. 2021b. Recently, I upgraded my MATLAB from R2021b to R2023a. And it seems strange since I didn't define 'NonNegative' in my options. Would the upgrade be the reason why I can't run them? Thanks a lot in advance.

4 commentaires

It works here —
options = odeset('RelTol',1e-10,'AbsTol',1e-10);
v = odeget(options,'NonNegative')
v = []
.
Hello Star, thank you for replying. I tried your code and it returned a similar error as my question statement:
options = odeset('RelTol',1e-10,'AbsTol',1e-10);
v = odeget(options,'NonNegative')
Error using odeget
Unrecognized property name 'NonNegative'. See ODESET for possibilities.
I don't know what is wrong here......
Could you verify that you have the Optimization Toolbox installed and licensed?
Also what shows up for
which -all odeset
Hello Walter, thank you for pointing this out. I have the Optimization Toolbox installed and licensed. I ran your codes and there are 2 'odeset.m' existing in my path, /MatCont7p3/Continuer/odeset.m and /Applications/MATLAB_R2023a.app/toolbox/matlab/funfun/odeset.m
Is there a way that I can avoid calling the MatCont odeset? Maybe move the MatCont path down below the toolbox path?

Connectez-vous pour commenter.

 Réponse acceptée

You can use pathtool() to move MatCont7p3 further down in your path.
This is likely to interfere with running part of MatCont7p3.. but perhaps you would be okay.

22 commentaires

It works after moving MatCont7p3 further down. Thank you for helping!
I do not understand. Please expand on it more clearly. How to move down
At the command line, command
pathtool
Use your scroll wheel to look through the list in the right hand side, "MATLAB search path:"
When you find the entry for MatCont7p3 left-click on the entry (once) to select it. Then move your cursor over to the buttons on the left side and click on the "Move to Bottom" button. Now to go the buttons on the bottom and click on "Save" and then on "Close"
Thank you for your quick response, but I still fail. It still appear the same error. I do not know how to fix it, although I move down the file in the bottom of the path.
Please show the output of
which -all odeset
Also, which MATLAB release are you using?
The version is 2023. when I use command you suggest, it has two odeset, one of which is C:\MATLAB\toolbox\matlab\funfun\odeset.m. I think it has a comflict with matcont. But how to fix this issue.To be honest, I have no idea.
Please show the exact output of the which command. Details are important for this purpose.
Please show the exact output of the which command. Details are important for this purpose.
After I put in which -all odeset. The window shows C:\MATLAB\toolbox\MatCont7p4\Continuer\odeset.m C:\MATLAB\toolbox\matlab\funfun\odeset.m % Shadowed. Then I do not know how to do.
Okay, so follow my previous pathtool instructions, except this time look for MatCont7p4 instead of my earlier instructions for MatCont7p3 (maybe you had both installed?)
Sorry, I only install one single MatCont7p4. And I do move down in the path. But it still doesn't work out.
Once you have moved it down the path and invoked the save function, then the "which" output should not show the matcont7p4 version before the built-in version.
You could **try*
rehash toolboxcache
-- I see that MatCont7p4 has been installed inside the toolbox directory, which is reserved for Mathworks (and Maplesoft, for historic licensing reasons.)
Sorry, dude. I do not understand your solution. When I put in rehash order, it turns out Warning: Function dissect has the same name as a MATLAB built-in. We suggest you rename the function to avoid a potential name conflict.
What shows up for
which -all disect
which -all odeset
C:\MATLAB\toolbox\MatCont7p4\Continuer\odeset.m
C:\MATLAB\toolbox\matlab\funfun\odeset.m % Shadowed
You need to uninstall MATLAB completely and reinstall it without installing MatCont at all.
If you need to use MatCont afterwards, get an experienced MATLAB adminstrator or consultant to install it, telling them to look at this thread before installing it.
Third-party toolboxes should not be installed underneath MATLAB\toolbox : when they get installed there, the MATLAB installation can effectively get corrupted.
This is not something that you have the skills to fix.
Thank you for your update. Walter. But my lab mate reinstall matlab, he still can not fix. I do not know how to solve on earth.
Try renaming the file C:\MATLAB\toolbox\MatCont7p4\Continuer\odeset.m to something else so it no longer takes precedence over the odeset function included as part of MATLAB. It is possible that doing so will prevent MatCont7p4 from working (if they've made changes that are required for operation of that program but are incompatible with the version of the function included as part of MATLAB.) If it does you should contact the authors of MatCont7p4 and ask them for help correcting the problem.
Thank you anyway, although I do it according to your advice (change the file name), it still cannot be fixed.
here is a quick fix: In the file MatCont7p3/Continuer/odeget.m, you can add a line (say at line 63, keeping alphabetical order) with the entry
'NonNegative '
Then ode45 executes without errors.
As MatCont developer, I acknowledge that this piece of code has to be updated, it's added to my to-do list, but it's academic software, so no promises on how fast I can execute that. Also, that won't be done here, but mentioned on MatCont's sourceforge page.
Is there a reason you need to have your own version of odeget.m rather than using the one included with MATLAB? Could the solution be to delete the odeget.m in the Continuer directory rather than updating it? Having your own copy that shadows the one in MATLAB means that you're likely going to have this type of conflict whenever we update the odeget function in MATLAB and that you would have to update it to get any benefit of bug fixes or improvements to the function in MATLAB.
I deleted the odeset.m in subfile of Matcont. But it reported a bug when I run a demo model. I have no idea of how to fix. Probabaly, I do not find the right solution.

Connectez-vous pour commenter.

Plus de réponses (1)

I have the same error: Unrecognized property name 'NonNegative'. See ODESET for possibilities.
I am trying to use matcont on mac on R2023a Version of Matlab. Already installed Xcode.
The GUI opens normal, but everytime I am trying to Compute a ODE System it gets the error.
If I run which -all odeset I also get 2 path:
1) Code/Matlab/MatCont7p4/Continuer/odeset.m
2) /Applications/MATLAB_R2023a.app/toolbox/matlab/funfun/odeset.m
Does anybody know how to fix this problem?

2 commentaires

As I wrote above (as MatCont developer!), and probably the culprit of this problem, here is a quick fix: In the file MatCont7p3/Continuer/odeget.m, you can add a line (say at line 63, keeping alphabetical order) with the entry:
'NonNegative '
After that, on my machines, simulations again work.
Thank you Hil Meijer, this seems to fix the problem!
Now Matcont works perfectly!
Great to get advice from a MatCont developer.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Produits

Version

R2023a

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by