4. Vorlesung, 1. Teil

Loesung linearer Gleichungssysteme

Contents

clear all;
format short;

Wir betrachten das lineare Gleichungssystem

y = 3x -1

y = -2x + 7

Zunaechst shreiben wir das System in der Form A x = b

A = [3 -1; -2 -1]
A =

     3    -1
    -2    -1

b = [1; -7]
b =

     1
    -7

Berechnung der inversen Matrix

x1 = inv(A)*b
x1 =

    1.6000
    3.8000

Probe:

r1 = b-A*x1  % Berechne Residuum
r1 =

   1.0e-14 *

    0.0444
    0.1776

Der backslash Operator

Dies ist die einfachste Art und Weise ein Gleichungssystem in Matlab zu loesen.

x2 = A\b
x2 =

    1.6000
    3.8000

r2 = b-A*x2
r2 =

   1.0e-15 *

   -0.4441
    0.8882