TU Wien:Computernumerik VU (Schranz-Kirlinger)/Übungen SS16/Beispiel 11
Zur Navigation springen
Zur Suche springen
Lösung[Bearbeiten | Quelltext bearbeiten]
Matlab Code
function Bsp1 A1 = [1 1; 1 2]; A2 = [1 1; 1 1.00001]; b1 = [1 1]'; b2 = [0.99999 1.00001]'; x1 = A1 \ b1; x2 = A1 \ b2; x3 = A2 \ b1; x4 = A2 \ b2; A1inv = inv(A1); A2inv = inv(A2); Kappa1 = norm(A1) * norm(A1inv); Kappa2 = norm(A2) * norm(A2inv); fprintf('A1 x=b1 -> x = %.10f %.10f\nA1 x=b2 -> x = %.10f %.10f\nA2 x=b1 -> x = %.10f %.10f\nA2 x=b2 -> x = %.10f %.10f\n', x1(1),x1(2), x2(1),x2(2), x3(1),x3(2), x4(1),x4(2)); fprintf('Konditionszahl:\nKappa1 %.10f\nKappa1 %.10f\n', Kappa1, Kappa2); end