Use second-order and fourth-order Runge-Kutta methods
์กฐํ ์: 2 (์ต๊ทผ 30์ผ)
์ด์ ๋๊ธ ํ์
The one-dimensional linear convection equation for a scalar T is,
๐๐/๐๐ก + ๐*๐๐/๐๐ฅ = 0 0 โค ๐ฅ โค 1
With the initial condition and boundary conditions of, (๐ฅ, 0) = ๐ ^(โ200(๐ฅโ0.25)^ 2) , ๐(0,๐ก) = 0, ๐(1,๐ก): outflow condition Take ๐ = 1, โ๐ฅ = 0.01
Plot the results for t = 0.25, .5, 0.75 for both of them.
๋๊ธ ์: 2
๋ต๋ณ (1๊ฐ)
darova
2021๋
3์ 9์ผ
I'd try simple euler scheme first. The scheme i used
๐๐/๐๐ก + ๐*๐๐/๐๐ฅ = 0
clc,clear
a = 1;
x = 0:0.01:1;
t = 0:0.01:0.75;
U = zeros(length(t),length(x));
U(1,:) = exp(-200*(x-0.25).^2);
U(:,1) = 0;
dx = x(2)-x(1);
dt = t(2)-t(1);
for i = 1:size(U,1)-1
for j = 1:size(U,2)-1
U(i+1,j) = U(i,j) + a*dt/dx*(U(i,j+1)-U(i,j));
end
end
surf(U)
๋๊ธ ์: 0
์ฐธ๊ณ ํญ๋ชฉ
์นดํ ๊ณ ๋ฆฌ
Help Center ๋ฐ File Exchange์์ Ordinary Differential Equations์ ๋ํด ์์ธํ ์์๋ณด๊ธฐ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!