首页 > 电脑

帮忙看一下这个MATLAB代码,运行了没反应,是有什么错误吗?新手求指导

更新时间2018-03-06 22:01:40

帮忙看一下这个MATLAB代码,运行了没反应,是有什么错误吗?新手求指导

function pdex1

m = 0;

r = linspace(0,0.01,0.5);

z = linspace(0,0.05,2);

sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,r,z);

% Extract the first solution component as u.

t = sol(:,:,1);

% A surface plot is often a good way to study a solution.

surf(r,z,t)

title('Numerical solution computed with 20 mesh points.')

xlabel('radial r')

ylabel('axial t')

% A solution profile can also be illuminating.

figure

plot(r,z(end,:))

title('Solution at z = 2')

xlabel('Distance r')

ylabel('t(r,2)')

% --------------------------------------------------------------

function [c,f,s] = pdex1pde(x,t,u,DuDx)

c = A*(0.02^2*ln(r/0.015)+0.5*(0.015^2-r^2));

A=a^2*9.81*d/b/2/c;

a=0.3417*0.274^(-(1-(t+273.15)/647.13)^0.28571);

b=10^(-4.5318-220.57/(149.39-(t+273.15)));

c=-0.2758+0.004612*(t+273.15)-0.0000055391*(t+273.15)*(t+273.15);

d=92.053-0.03995*(t+273.15)-0.00021103*(t+273.15)*(t+273.15)+0.00000053469*(t+273.15)*(t+273.15)*(t+273.15);

f = 1/r*Dr(r* Dr);

s = 0;

% --------------------------------------------------------------

function u0 = pdex1ic(r)

u0 = 101;

% --------------------------------------------------------------

function [pl,ql,pr,qr] = pdex1bc(rl,tl,rr,tr,z)

pl = tl;

ql = 98;

pr = 101;

qr = 2;


matlab要求每一个函数存放在单独的m文件中并且文件名与函数名相同。

上一篇:c++查取大整数的因数

下一篇:theano离线安装出错,希望各位大侠帮帮忙,谢谢