Programming LearnByExample Octave
15 July 06:23
Agnate to Matlab.
Suppose you wish to solve
3x + 6y + 8z = 3
78x + 4y + 2z = 0
77x + 32y + 14z = -4
octave> a = [3 6 8 ; 78 4 2; 77 32 14]
a =
3 6 8
78 4 2
77 32 14
octave> b = [3 0 -4]
b =
3
0
-4
the abettor transposes a matrix/vector. Defining b = [3;0;-4] is the aforementioned result.
octave> a
ans =
3 78 77
6 4 32
8 2 14
3x + 6y + 8z = 3
78x + 4y + 2z = 0
77x + 32y + 14z = -4
octave> d = [3 6 8 3; 78 4 2 0 ; 77 32 14 -4]
d =
3 6 8 3
78 4 2 0
77 32 14 -4
octave> rref(d)
ans =
1.00000 0.00000 0.00000 0.00472
0.00000 1.00000 0.00000 -0.44600
0.00000 0.00000 1.00000 0.70773
With the solution
x = 0.00472
y = -0.44600
z = 0.70773
octave> c= a
c =
0.0047249
-0.4460007
0.7077287
octave> a ans =
3.00000
0.00000
-4.00000
As you can see, b = a
Suppose you wish to solve
3x + 6y + 8z = 3
78x + 4y + 2z = 0
77x + 32y + 14z = -4
octave> a = [3 6 8 ; 78 4 2; 77 32 14]
a =
3 6 8
78 4 2
77 32 14
octave> b = [3 0 -4]
b =
3
0
-4
the abettor transposes a matrix/vector. Defining b = [3;0;-4] is the aforementioned result.
octave> a
ans =
3 78 77
6 4 32
8 2 14
3x + 6y + 8z = 3
78x + 4y + 2z = 0
77x + 32y + 14z = -4
octave> d = [3 6 8 3; 78 4 2 0 ; 77 32 14 -4]
d =
3 6 8 3
78 4 2 0
77 32 14 -4
octave> rref(d)
ans =
1.00000 0.00000 0.00000 0.00472
0.00000 1.00000 0.00000 -0.44600
0.00000 0.00000 1.00000 0.70773
With the solution
x = 0.00472
y = -0.44600
z = 0.70773
octave> c= a
c =
0.0047249
-0.4460007
0.7077287
octave> a ans =
3.00000
0.00000
-4.00000
As you can see, b = a
|
Tags: programming octave, , programming learnbyexample octave, |
Also see ...
PermalinkArticle In : Computers & Technology - Programming