Error in running the Example script of pdepe

27 次查看(过去 30 天)
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?

采纳的回答

Torsten
Torsten 2024-11-28,19:04
编辑:Torsten 2024-11-28,19:06
As you can see, the code runs under MATLAB R2024b (and should be no problem under R2023b, too).
I suggest contacting Technical Support:
  6 个评论
Torsten
Torsten 2024-11-29,9:47
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 Pugliese
Andrea Pugliese 2024-11-29,10:55
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by