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?

 Accepted Answer

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

6 Comments

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
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.
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.
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".
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.

Sign in to comment.

More Answers (0)

Products

Release

R2023b

Asked:

on 28 Nov 2024

Commented:

on 29 Nov 2024

Community Treasure Hunt

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

Start Hunting!