Error in running the Example script of pdepe

I have copied the script presented as the first example in the Help page of pdepe.
When I try to run it, I get the error "Error using odeget Unrecognized property name 'InitialSlope'....."
This is the script
x = linspace(0,1,25);
t = linspace(0,1,25);
m = 1;
sol = pdepe(m,@heatcyl,@heatic,@heatbc,x,t);
u = sol(:,:,1);
surf(x,t,u)
xlabel('x')
ylabel('t')
zlabel('u(x,t)')
view([150 25])
plot(t,sol(:,1))
xlabel('Time')
ylabel('Temperature u(0,t)')
title('Temperature change at center of disc')
function [c,f,s] = heatcyl(x,t,u,dudx)
c = 1;
f = dudx;
s = 0;
end
%----------------------------------------------
function u0 = heatic(x)
n = 2.404825557695773;
u0 = besselj(0,n*x);
end
%----------------------------------------------
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)
n = 2.404825557695773;
pl = 0; %ignored by solver since m=1
ql = 0; %ignored by solver since m=1
pr = ur-besselj(0,n)*exp(-n^2*t);
qr = 0;
end
When I try to run this, I get the error
Error using odeget
Unrecognized property name 'InitialSlope'. See ODESET for possibilities.
Error in ode15s (line 229)
yp0 = odeget(options,'InitialSlope',[]);
Error in pdepe (line 287)
[t,y] = ode15s(@pdeodes,t,y0(:),opts);
Error in test_pdepe_Matlab (line 4)
sol = pdepe(m,@heatcyl,@heatic,@heatbc,x,t);
I am using Matlab R2023b on a MacBook Air under MacOS Sonoma 14.6.1
Should I update Matlab and/or MacOS? Other suggestions?

 Réponse acceptée

Torsten
Torsten le 28 Nov 2024
Modifié(e) : Torsten le 28 Nov 2024

0 votes

As you can see, the code runs under MATLAB R2024b (and should be no problem under R2023b, too).
I suggest contacting Technical Support:

6 commentaires

Andrea
Andrea le 28 Nov 2024
Thank you for your answer.
However I have only one ode15s in Matlab, in this path
/Applications/MATLAB_R2023b.app/toolbox/matlab/funfun/ode15s.m (I hope it is the correct one).
Indeed if I set an option with odeset, and look at the results, I see a few fields missing relatively to what described in the Help. In particular, the three last fields MStateDependence, MvPattern and InitialSlope are missing in the options I see.
I suppose I will update to Matlab R2024b, and see if the problem persists.
I just tested on R2023b. If I do
odeset()
then the output includes
InitialSlope: [ vector ]
What shows up if you query
which -all odeset
Andrea
Andrea le 29 Nov 2024
Thanks for your answer.
It seems this is just the problem. When I query "which -all odeset", I get
/Users/pugliese/programs/MATLAB/MatCont7p4/Continuer/odeset.m
/Applications/MATLAB_R2023b.app/toolbox/matlab/funfun/odeset.m % Shadowed
which means that MatCont7p4 has introduced another "odeset.m" that shadows the standard one.
Now I'll try to understand what I can do about, possibly working on PATH.
Andrea
Andrea le 29 Nov 2024
Indeed, having changed the order of folders in path, pdepe works.
I wonder whether matcont would now work correctly, but I'll look at that later.
Thanks again for the suggestion.
Torsten
Torsten le 29 Nov 2024
You should rename the "odeset.m" under the path
/Users/pugliese/programs/MATLAB/MatCont7p4/Continuer/odeset.m
It seems to be a file that you've created.
There is no need to change "the order of folders in path".
Andrea
Andrea le 29 Nov 2024
Thanks. However, I have not created it directly. It was created by the package MatCont that I have installed. I am afraid that, if I change that name, the package will not work... I will send a message to the developers of MatCont.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Numerical Integration and Differential Equations dans Centre d'aide et File Exchange

Produits

Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by