필터 지우기
필터 지우기

how can i separate a matrix into a multiplication of two matrices One of Real Values and the Other for Integer values.

조회 수: 14 (최근 30일)
hello,
how can i separate a matrix X into a multiplication of two matrices Y and Z with Y contain Real Values and Z contain Integer values using MATLAB.
such as: X=Y*Z
with:
X= my Input Matrix of NxN.
and i search to obtain:
Y: matrix of integer values.
Z: Matrix of Real Values.
X is suposed to be a NxN matrix.

채택된 답변

Bruno Luong
Bruno Luong 2019년 7월 8일
편집: Bruno Luong 2019년 7월 8일
Of course.
Test matrix
X = rand(5)
n = length(X)
then
Z = ceil(1000*rand(n,n))
Y = X/Z
Y*Z
  댓글 수: 3
ahcen aliouat
ahcen aliouat 2019년 7월 9일
hello,
please @bruno could you give me an idea on how to get it in a way that the Real values matrix will be a diagonal matrix? ( identified just in the diagonal )
i will appreciate your help.
thank you
Bruno Luong
Bruno Luong 2019년 7월 9일
편집: Bruno Luong 2019년 7월 9일
In general it's not possible for any X.
If you have such decompistion, it's equivalent to each column of X has a common divisor (on the diagonal of Z). And that is right for all column.
This condition is quite strict. But if you know X meets this, then you can write down:
X(:,j) = sum k_(i,j) d_j, for all j=1,2,...,n, with k_(i,j) integers
Then simply take
Z = diag(d)
Y(i,j) = k_(i,j)
You might try to apply euclidian algorithm to find a common divisor of floating points (if any), I'm not sure the bad-effect of floating points round-off on such algorithm (I guess it's far from robust).

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Raj
Raj 2019년 7월 8일
There are infinite combinations possible (atleast by theory) in which you can split a real number to multiplication of a real number and an integer. Let me explain:
X=rand(N,N) % your matrix
Y=randi(M,N) % any NxN integer matrix with upper limit as M. INFINITE Possibilities here.
then
Z=X./Y % matrix of real values.
So that you can multiply Y & Z to get back X
X1=Y.*Z
isequal(X,X1) % confirms that X and X1 are equal.
Cheers!!
  댓글 수: 1
ahcen aliouat
ahcen aliouat 2019년 7월 9일
thank you very much.
do you have an idea on how to get it in a way that the Real values matrix will be a diagonal matrix? ( identified just in the diagonal )
i will appreciate your help.
thank you

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by