Error in KPZ (line 13) surf(x,t,w)

2 次查看(过去 30 天)
Dear friends. I am trying this but there is a problem in all "s"
What should I do in order to dial with this situation?
opts = odeset('RelTol',1e-8,'AbsTol',1e-8);
N=200; xi=0.02; xf=0.5; ti=1; tf=100; TIME=tf-ti;
%x=1:0.5:15;
%t=1:100:28800;
x = linspace(xi,xf,N);
t = linspace(ti,tf,200);
m = 0;
tic
sol = pdepe(m,@heat1D,@heatIC,@bcfun,x,t);
toc
w = sol(:,:,1);
surf(x,t,w)
xlabel('x')
ylabel('t')
zlabel('w(x,t)')
view([40 55])
%plot(w(200,:))
function [c,f,s] = heat1D(x,t,w,dwdx)
D=0.5; %0.2;
c = 1;
f = 1/2.*D*dwdx;
s = 100*dwdx.^2; %% NO NOISE
%s = 0.5*dwdx.^2 + 0.5/t; %%White
%s = 0.5*dwdx.^2 - 1/(x*sqrt(t)); %%Pink
%s = 3*dwdx.^2 - 0.1/(x*x); %%Brown
%s = -55/2*dwdx.^2 - 0.1*exp(-x*x/t)/t; %%Gauss
end
function w0 = heatIC(x)
%w0 =2;
w0=0.1*sin(2*x)+0.1*cos(2*x);
%w0=-0.5-0.3/(x+0.1)^2;
end
function[pl,ql,pr,qr]=bcfun(xl,ul,xr,ur,t)
pl = ul;
ql = 0;
pr = 0;
qr = 1;
end

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Partial Differential Equation Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by