I have matrix A, calculate null(A) but then A*null(A) doesn't give me 0?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
%a) The traffic flow is an overdetermined system 12 variables to 9 equations
A = [-1 0 0 0 0 0 0 1 0 0 0 0;
1 1 0 0 0 0 0 0 0 0 -1 0;
0 -1 1 0 0 0 0 0 0 0 0 0;
0 0 -1 -1 0 0 0 0 0 0 0 1;
0 0 0 1 1 0 0 0 0 0 0 0 ;
0 0 0 0 1 1 0 0 -1 0 0 0;
0 0 0 0 0 -1 1 0 0 0 0 0;
0 0 0 0 0 0 -1 -1 0 1 0 0;
0 0 0 0 0 0 0 0 1 -1 1 -1];
b = [0; 150; 20; -410; 180; 210; 80; -230; 0];
%b)Gives five free variables, so there is not a unique solution,
%meaning the traffic flow depends in other intersects
x = linsolve(A,b);
%e)
nullspace = null(A) %Three vectors in the nullspace
nullVector = A* nullspace(:,1) %Shouldn't this give me zero vector?
I am wondering if I calculate null(A) and tree null vectors:
0.0939 0.3560 -0.3875
-0.1103 0.2839 0.4184
-0.1103 0.2839 0.4184
-0.0000 0.0000 0.0000
0.0000 -0.0000 -0.0000
0.4610 -0.0825 0.2202
0.4610 -0.0825 0.2202
0.0939 0.3560 -0.3875
0.4610 -0.0825 0.2202
0.5549 0.2734 -0.1674
-0.0164 0.6399 0.0309
-0.1103 0.2839 0.4184
Shouldn't that mean A*nullspaceVector = 0 ?
But nullVector = A* nullspace(:,1) gives me:
nullVector =
1.0e-15 *
0.0139
-0.1180
0.3053
-0.3053
-0.0714
0.2776
-0.1665
0.2220
0.0971
1 Kommentar
Bruno Luong
am 21 Okt. 2020
Bearbeitet: Bruno Luong
am 21 Okt. 2020
1.0e-15 * somenumber is considered as 0 numerically in floating point calculation.
Illustration of the same thing with simpler example
>> x=[3 4];
>> y=null(x)
y =
-0.8000
0.6000
>> x*y
ans =
-4.4409e-16
Antworten (1)
Steven Lord
am 21 Okt. 2020
Note that the description of the output argument on the documentation page for the null function does not include the character 0. It says that Z satisfies two properties, the key one of which for this question is "A*Z has negligible elements."
I would call 1e-15 or 1e-16 negligible relative to the elements in your matrix.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Elementary Math finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!