simulation of program in matlab

3 views (last 30 days)
bandar
bandar on 15 Jan 2024
Edited: bandar on 1 Feb 2024
...

Answers (2)

Torsten
Torsten on 15 Jan 2024
Moved: Torsten on 15 Jan 2024
Use MATLAB's "pdepe".

Torsten
Torsten on 15 Jan 2024
Moved: Torsten on 15 Jan 2024
M2_eq = 1;
D2_ov = 1e-2;
m=2;
x = linspace(0,1,100);
t = linspace(0,2,10);
u = pdepe(m,@(x,t,u,DuDx)eqn1(x,t,u,DuDx,D2_ov),@initail1,@(xl,ul,xr,ur,t)bc1(xl,ul,xr,ur,t,M2_eq),x,t);
surf(x,t,u)
function [c,f,s] = eqn1(x,t,u,DuDx,D2_ov)
c = 1;
f = D2_ov*DuDx;
s = 0;
end
%-----------------------------------------------------------------
function [pl,ql,pr,qr] = bc1(xl,ul,xr,ur,t,M2_eq)
pl=0;
ql=1;
pr=ur-M2_eq;
qr=0;
end
%-----------------------------------------------------------
function value=initail1(x)
value=0;
end
%------------------------------------------------------

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!