发布网友 发布时间:2022-05-29 08:39
共1个回答
热心网友 时间:2023-10-13 02:28
第一小题:
结果:
代码:
function fun1
clear all
clc
x=0:0.01:1;
t=0:0.01:1;
m = 0;
sol = pdepe(m,@pdefun,@ic,@bc,x,t);
u = sol(:,:,1);
mesh(x,t,u)
title('Numerical solution of pdefun')
xlabel('Distance x')
ylabel('Time t')
zlabel('Temperature u')
function [c,f,s] = pdefun(x,t,u,DuDx)
c = 1;
f = DuDx;
s = sin(2*t);
function u0 = ic(x)
u0 = cos(x);
function [pl,ql,pr,qr] = bc(xl,ul,xr,ur,t)
pl = ul;
ql = 0;
pr = ur;
qr = 0;
追答后面两问用常微分的方法求解即可