Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (17 sloc) 493 Bytes
diff = @(t, yt) 0.1*yt + sin(2*t);
a = 0;
b = 6;
h = 0.2;
n = (b - a) / h;
y0 = 0;
[xEul, yEul] = Euler_Klassisch(diff, a, b, n, y0);
[xRunge, yRunge] = Runge_Kutta_4(diff, a, b, n, y0);
% replace all subplots with figure(i) to display in i windows
subplot(2,1,1);
plot(xEul, yEul, xRunge, yRunge);
legend("EulerKlassisch", "RungeKutta");
% betragm�ssige Differenz
differenzen = abs(yEul - yRunge);
subplot(2,1,2);
% halbalgorithmisch in abh�ngikeit zeit t
semilogy(xEul, differenzen);
You can’t perform that action at this time.