对流方程偏微分方程的数值解法用迎风格式解对流方程function u = peYF(a,dt,n,minx,maxx,M)format long;h = (maxx-minx)/(n-1);if a0 for j=1:(n+M) u0(j) = IniU(minx+(j-M-1)*h); endelse for j=1:(n+M) u0(j) = IniU(minx+(j-1)*h); endendu1 = u0;for k=1:M if a0 for i=(k+1):n+M u1(i) = -dt*a*(u0(i)-u0(i-1)/h+u0(i); end else for i=1:n+M-k u1(i) = -dt*a*(u0(i+1)-u0(i)/h+u0(i); end end u0 = u1;endif a0