Clear Filters
Clear Filters

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

2 views (last 30 days)
Okhunjon Sayfidinov
Okhunjon Sayfidinov on 30 Apr 2020
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

Answers (0)

Categories

Find more on Partial Differential Equation Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!