稳定性:
数值例子
例一
例二
代码
% function chap4_hyperbolic_1st0rder_1D
% test the upwind scheme for 1D hyperbolic equation
% u_t + a*u_x = 0,0<x<L,O<t<T,
% u(x,0) = |x-1|,0<X<L,
% u(0,t) = 1% foundate = '2015-4-22’;
% chgedate = '2020-06-14’;
% by ZxpL= 5;
T = 5;
a = 1;
N = 100; % number of subintervals of the partition of time
J=50; % number of subintervals of the partition of space
dt = T/N;
dx = L/J;
x=(0:dx:L)';
r=a*dt/dx;% exact_sol = @exact_sol_1;
% init = @init_val_1;
% u_left = @u_left_1;
% u_right = @u_right_1;
% u_0 = init(x);exact_sol = @exact_sol_2;
init =