simulation of program in matlab

回答 (2 件)

Torsten
Torsten 2024 年 1 月 15 日
移動済み: Torsten 2024 年 1 月 15 日

0 投票

Use MATLAB's "pdepe".
Torsten
Torsten 2024 年 1 月 15 日
移動済み: Torsten 2024 年 1 月 15 日

0 投票

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
%------------------------------------------------------

製品

リリース

R2023b

質問済み:

2024 年 1 月 15 日

編集済み:

2024 年 2 月 1 日

Community Treasure Hunt

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

Start Hunting!

Translated by