Kleines Beispiel zur Lösung von linearen Gleichungssystemen in R / R-Project

Thomas Darimont

Erfahrenes Mitglied
Hallo,

hier ein kleines Beispiel zur Lösung eines linearen Gleichungssystems in R (http://www.r-project.org/)
Hier die Excel Variante des Beispiels:
http://www.tutorials.de/office-anwe...chungssystems-mit-ols-und-matrix-formeln.html

Gleichungssystem:

x0 x1 x2 b
-1000 40 30 | -2690
50 -2000 60 | -7550
60 90 -3000 | -14460

R-Code:
Code:
A <- matrix(c( -1000, 	 40, 	    30, 
				  50, -2000,	    60,
				  60,  	 90,	 -3000), nrow=3, ncol=3,byrow=T)
				  
b <- c(-2690,-7550,-14460)

y <- solve(A,b)

A
b

y

Ausgabe:
Code:
> A <- matrix(c( -1000,  40,     30, 
+   50, -2000,    60,
+   60,   90, -3000), nrow=3, ncol=3,byrow=T)
>   
> b <- c(-2690,-7550,-14460)
> 
> y <- solve(A,b)
> 
> A
      [,1]  [,2]  [,3]
[1,] -1000    40    30
[2,]    50 -2000    60
[3,]    60    90 -3000
> b
[1]  -2690  -7550 -14460
> 
> y
[1] 3 4 5
>

Gruß Tom
 
Zurück