MATLAB高手求教 Error:Function definitions are not permitted at t
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/14 08:19:58
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')
这段偏微分问题的程序有什么问题吗?为什么老是提示我这个错误?
%% 目标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')
这段偏微分问题的程序有什么问题吗?为什么老是提示我这个错误?
我可以运行,也许你要注意脚本文件与m文件之间的差别,不能直接在命令窗口和直接新建的m文件(脚本文件script)中运行.你要将这个函数命令保存为一M函数文件,保存为文件名与函数名一致,然后再命令窗口输入定义的函数,敲回车就可以运行出结果.
MATLAB高手求教 Error:Function definitions are not permitted at t
matlab:Error:Function definitions are not permitted in this
Error: Function definitions are not permitted at the prompt
Error:Function definitions are not permitted at the prompt o
matlab中Error:Function definitions are not permitted at the p
matlab 出现Function definitions are not permitted at the promp
在matlab中,Function definitions are not permitted at the promp
matlab报错Function definitions are not permitted at the prompt
matlab 不能运行 Function definitions are not permitted at the pr
matlab:出现错误Function definitions are not permitted in this co
Function definitions are not permitted at the prompt or in s
matlab 中定义函数,如何定义,我每次都会出现这个问题?Error: Function definitions ar