Added Group Members, Tested Matlab

This commit is contained in:
Moonwalker777 2022-05-17 17:10:11 +02:00
parent c05ea06703
commit 2d224ce7ea
3 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,4 @@
12134931, Biancchi Riccardo
01128052,Kapla Daniel Benjamin
01630056, Kuen Jakob
01620740, Müller David

44
Exercise_03/NSSC_3.asv Normal file
View File

@ -0,0 +1,44 @@
%% exercise number 2
%problem characteristics
U=0.7;%convection velocity
delta_x=0.01; %space discretization
L=1; %max length of our domain
T=1; %max time considered
N=L/delta_x; %number of intervals in space
K=100; %number of intervals in time
%two initial conditions
square_pulse=@(x) heaviside(x-0.1) - heaviside(x- 0.3);
gauss_signal=@(x) exp(-10*(4*x - 1).^2);
[x,t,c] = UW_scheme(L,N,T,K,U,square_pulse);
ex_sol=@(x,t) square_pulse(x-U*t);
f1=figure(1);
set(f1, 'Position', [10 10 height]);
for ii=1:K+1
clf(f1)
hold on
plot(x,c(:,ii)','-bo');
plot(x,ex_sol(x,t(ii)));
hold off
legend("aproximated solution","exact solution")
xlim([0 L])
ylim([0 1.1])
pause(0.02);
end
[x,t,c] = UW_scheme(L,N,T,K,U,gauss_signal);
ex_sol=@(x,t) gauss_signal(x-U*t);
f2=figure(2);
for ii=1:K+1
clf(f2)
hold on
plot(x,c(:,ii)','-bo');
plot(x,ex_sol(x,t(ii)));
legend("aproximated solution","exact solution")
xlim([0 L])
ylim([0 1.1])
pause(0.02);
end

View File

@ -15,6 +15,7 @@ gauss_signal=@(x) exp(-10*(4*x - 1).^2);
[x,t,c] = UW_scheme(L,N,T,K,U,square_pulse); [x,t,c] = UW_scheme(L,N,T,K,U,square_pulse);
ex_sol=@(x,t) square_pulse(x-U*t); ex_sol=@(x,t) square_pulse(x-U*t);
f1=figure(1); f1=figure(1);
set(f1, 'Position', [100 100 1500 1500]);
for ii=1:K+1 for ii=1:K+1
clf(f1) clf(f1)
hold on hold on