Schiessmethode¶
Das Beispiel benutzt eine zweistufige vollimplizite Methode (Verfahren nach Hammer-Hollingworth oder implizit Runge-Kutta zweiter Ordnung).
Download: hammerholingsworth.py
Als Matlab Beispiel:
%% Beispiel Schiessmethode
%% AWP 1. Beispiel
f = @(x,y) [y(2); -1; y(4); 0];
%% AWP 2. Beispiel
f = @(x,y) [y(2); -y(1).^2-1; y(4); -2*y(1)*y(3)];
xstart = 0;
xend = 1;
%% numerische Berechnung für alpha mit Hilfe des Newton Verfahrens
n = 1000;
tol = 1e-15;
k = 0;
alpha = -1;
y0 = [0; alpha; 0; 1];
[t, y] = explicitRungeKutta(f, n, xstart, xend, y0);
fprintf('%d\t%15.14f\t%15.14f\n', k, alpha, y(1,end))
plot(t,y(1,:))
grid on
hold on
while abs(y(1,end))>tol && k < 10
G = y(1,end); % Lösung des AWP
dG = y(3,end); % partielle Ableitung nach alpha von y
alpha = alpha - G/dG;
y0 = [0; alpha; 0; 1];
[t, y] = explicitRungeKutta(f, n, xstart, xend, y0);
k = k+1;
fprintf('%d\t%15.14f\t%15.14f\n', k, alpha, y(1,end))
plot(t,y(1,:))
hold on
end
Download: schiessmethode.m
explicitRungeKutta.m