导读:MATLAB高手求教 Error:Function definitions are not permitted at t MATLAB高手求教 Error:Function definitions are not permitted at the prompt or in scripts.%% 目标PDE函数function [c,f,s]=pdefun (x,t,u,du)c...
MATLAB高手求教 Error:Function definitions are not permitted at t
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')
这段偏微分问题的程序有什么问题吗?为什么老是提示我这个错误?
cedrus
1年前他留下的回答
已收到1个回答
2005yu
网友
该名网友总共回答了17个问题,此问答他的回答如下:采纳率:94.1%
我可以运行,也许你要注意脚本文件与m文件之间的差别,不能直接在命令窗口和直接新建的m文件(脚本文件script)中运行.你要将这个函数命令保存为一M函数文件,保存为文件名与函数名一致,然后再命令窗口输入定义的函数,敲回车就可以运行出结果.
1年前他留下的回答
3
以上就是小编为大家介绍的MATLAB高手求教 Error:Function definitions are not permitted at t 的全部内容,如果大家还对相关的内容感兴趣,请持续关注上海建站网!
标签:
内容声明:网站所展示的内容均由第三方用户投稿提供,内容的真实性、准确性和合法性均由发布用户负责。上海建站网对此不承担任何相关连带责任。上海建站网遵循相关法律法规严格审核相关关内容,如您发现页面有任何违法或侵权信息,欢迎向网站举报并提供有效线索,我们将认真核查、及时处理。感谢您的参与和支持!