Commit 6b256c68 authored by Gidon Lucian Bauer's avatar Gidon Lucian Bauer 🏳
Browse files

mean_init_cond verbessert

parent 08f43fa7
......@@ -27,15 +27,15 @@ F3 = @lax_wendroff_flux;
%% 1)
if choice == 1
%% Setup
N = 400;
N = 100;
tspan = [0; 1];
xspan = [-1; 1];
x = linspace(xspan(1), xspan(2), N);
% u0 = mean_init_cond(@step_func, xspan, N);
u0 = mean_init_cond(@(x) sin(pi*x), xspan, N);
u0 = mean_init_cond(@step_func, xspan, N);
% u0 = mean_init_cond(@(x) sin(pi*x), xspan, N);
%% Solving the advection equation
[u1a, t1a] = FVM(u0, F1, fa, xspan, tspan, N);
......
......@@ -4,6 +4,6 @@ function [init_mean] = mean_init_cond(func, xspan, N)
init_mean = zeros(N,1);
for i = 1:N
init_mean(i) = 1/dx * integral(func, xspan(1) + i*dx, xspan(1) + (i+1)*dx);
init_mean(i) = 1/dx * integral(func, xspan(1) + (i - 0.5)*dx, xspan(1) + (i+0.5)*dx);
end
end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment