MATLAB高手求教 Error:Function definitions are not permitted at the prompt or in scripts.%% 目标PDE函数function [c,f,s]=pdefun (x,t,u,du)c=[1;1];f=[0.024*du(1);0.17*du(2)];temp=u(1)-u(2);s=[-1;1].*(exp(5.73*temp)-exp(-11.46*temp));%% 边界条

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/06 19:59:53
MATLAB高手求教 Error:Function definitions are not permitted at the prompt or in scripts.%% 目标PDE函数function [c,f,s]=pdefun (x,t,u,du)c=[1;1];f=[0.024*du(1);0.17*du(2)];temp=u(1)-u(2);s=[-1;1].*(exp(5.73*temp)-exp(-11.46*temp));%% 边界条
xT[O@+}!%ò]EI11!Ĵn,>-,eAWAu/,әv N;]$"!>dt;3;NwZKg[׃{ս42^ECU=zTxCRW%Er)JQ JtY2 b x.PʚA:%)T%H({9ֳ;`fi7DIhT(: `^3'P8rפ`,bm$3YKR7%TO in 5ߪw\0wH ÊӢ=;V7O \ lwɹ7_ߘS{UG Xqs{k:↛_ GaI5Zw*'JL])snHFR* vAVdfSdԋ,erZR5M+ 9@DIӳO))S1O|.+#הT:rMil<|a^wFa)VFr*8o %r2h&p& ՙE5ި X-lV/Xug{}A9gp |BsY +Vw<=`Ɲ{Ml8Uʛ<}Hr '×ɉk'#Va pLxHUN$\ 'DZl?g19o`~*y9~kNe] fKvy)UZ/'

MATLAB高手求教 Error:Function definitions are not permitted at the prompt or in scripts.%% 目标PDE函数function [c,f,s]=pdefun (x,t,u,du)c=[1;1];f=[0.024*du(1);0.17*du(2)];temp=u(1)-u(2);s=[-1;1].*(exp(5.73*temp)-exp(-11.46*temp));%% 边界条
MATLAB高手求教 Error:Function definitions are not permitted at the prompt or in scripts.
%% 目标PDE函数
function [c,f,s]=pdefun (x,t,u,du)
c=[1;1];
f=[0.024*du(1);0.17*du(2)];
temp=u(1)-u(2);
s=[-1;1].*(exp(5.73*temp)-exp(-11.46*temp));
%% 边界条件函数
function [pa,qa,pb,qb]=pdebc(xa,ua,xb,ub,t)
%a表示下边界,b表示上边界
pa=[0;ua(2)];
clc
x=0:0.05:1;
t=0:0.05:2;
m=0;
sol=pdepe(m,@pdefun,@pdeic,@pdebc,x,t);
figure('numbertitle','off','name','PDE Demo——by Matlabsky')
subplot(211)
surf(x,t,sol(:,:,1))
title('The Solution of u_1')
xlabel('X')
ylabel('T')
zlabel('U')
subplot(212)
surf(x,t,sol(:,:,2))
title('The Solution of u_2')
xlabel('X')
这段偏微分问题的程序有什么问题吗?为什么老是提示我这个错误?

MATLAB高手求教 Error:Function definitions are not permitted at the prompt or in scripts.%% 目标PDE函数function [c,f,s]=pdefun (x,t,u,du)c=[1;1];f=[0.024*du(1);0.17*du(2)];temp=u(1)-u(2);s=[-1;1].*(exp(5.73*temp)-exp(-11.46*temp));%% 边界条
我可以运行,也许你要注意脚本文件与m文件之间的差别,不能直接在命令窗口和直接新建的m文件(脚本文件script)中运行.你要将这个函数命令保存为一M函数文件,保存为文件名与函数名一致,然后再命令窗口输入定义的函数,敲回车就可以运行出结果.