I have matrix A, calculate null(A) but then A*null(A) doesn't give me 0?

5 ビュー (過去 30 日間)
Haraldur Blöndal Kristjánsson
Haraldur Blöndal Kristjánsson 2020 年 10 月 21 日
回答済み: Steven Lord 2020 年 10 月 21 日
%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 件のコメント
Bruno Luong
Bruno Luong 2020 年 10 月 21 日
編集済み: Bruno Luong 2020 年 10 月 21 日
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

サインインしてコメントする。

回答 (1 件)

Steven Lord
Steven Lord 2020 年 10 月 21 日
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.

カテゴリ

Help Center および File ExchangeAnalysis of Variance and Covariance についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by