I have a Matrix , and I want to multiply this Matrix with something so I can get zeros

16 ビュー (過去 30 日間)
% for an example *(pinv(P1))*P1=unity Matrix
I want the same thing : ?*P1=zeros
%This ? should be related to P1 like the above example when we took the peasudo inverse to get the unity matrix
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%This is the problem
clc;
clear;
H=[1 2 1;2 3 1;4 2 3;3 2 1];
P1=[3 2 4;2 1 1;5 2 3;2 3 7]
P2=[2 6 1;1 3 5;4 2 1;5 2 1];
HT=H+P1+P2
from this equation I want to get
HT=H+P2
I want to null P1
  2 件のコメント
Image Analyst
Image Analyst 2021 年 12 月 15 日
Original question attached (for after he delete it)
Rena Berman
Rena Berman 2021 年 12 月 16 日

(Answers Dev) Restored edit

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

採用された回答

Walter Roberson
Walter Roberson 2021 年 9 月 16 日
null(P1)
Note: this may have different number of columns depending on the values in P1. Each column of the result will be independent
  3 件のコメント
Matthew Worker
Matthew Worker 2021 年 9 月 16 日
clc;
clear;
H=[1 2 1;2 3 1;4 2 3;3 2 1];
P1=[3 2 4;2 1 1;5 2 3;2 3 7]
P2=[2 6 1;1 3 5;4 2 1;5 2 1];
HT=H+P1+P2
from this equation I want to get
HT=H+P2
I want to null P1
Walter Roberson
Walter Roberson 2021 年 9 月 16 日
format long g
H=[1 2 1;2 3 1;4 2 3;3 2 1];
P1=[3 2 4;2 1 1;5 2 3;2 3 7]
P1 = 4×3
3 2 4 2 1 1 5 2 3 2 3 7
P2=[2 6 1;1 3 5;4 2 1;5 2 1];
nP1 = null(P1.').'
nP1 = 1×4
-0.843274042711568 -0.105409255338946 0.421637021355784 0.316227766016838
nP1 * P1
ans = 1×3
-4.44089209850063e-16 0 4.44089209850063e-16
HT = H + nP1 * P1 + P2
HT = 4×3
3 8 2 3 6 6 8 4 4 8 4 2
HT2 = H + P2
HT2 = 4×3
3 8 2 3 6 6 8 4 4 8 4 2
HT - HT2
ans = 4×3
-4.44089209850063e-16 0 4.44089209850063e-16 -4.44089209850063e-16 0 0 0 0 0 0 0 4.44089209850063e-16

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

その他の回答 (1 件)

John D'Errico
John D'Errico 2021 年 9 月 16 日
編集済み: John D'Errico 2021 年 9 月 16 日
Please stop posting answers when you are making only comments.
In what you claim to have tried:
A=[-3 6 -1 1 7;1 -2 2 3 -1;2 -4 5 8 -4]
A = 3×5
-3 6 -1 1 7 1 -2 2 3 -1 2 -4 5 8 -4
the matrix A has rank 3.
rank(A)
ans = 3
So there is NO matrix you can multiply A with on the left except for the all zero matrix, and get a result of all zeros. That is, there does not exist a non-zero matrix X, such that the product X*A will be entirely zero. This is provable using basic linear algebra.
We can find a non-zero matrix Y such that A*Y will be all zeros. But that was not the question you seem to have posed. Thus...
Y = null(A);
norm(A*Y)
ans = 3.2420e-15
So effectively zero to with floating point precision. If you want an exact solution, since A is composed of integers, we can find one easily enough. Thus...
Ysym = null(sym(A))
Ysym = 
A*Ysym
ans = 
  4 件のコメント
Souarv De
Souarv De 2022 年 6 月 9 日
@John D'Errico Here the answer would come with class sym. How to convert it back in to double?
Walter Roberson
Walter Roberson 2022 年 6 月 9 日
A = [-3 6 -1 1 7;1 -2 2 3 -1;2 -4 5 8 -4]
A = 3×5
-3 6 -1 1 7 1 -2 2 3 -1 2 -4 5 8 -4
Ysym = null(sym(A))
Ysym = 
A*Ysym
ans = 
double(ans)
ans = 3×2
0 0 0 0 0 0

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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by