Hello everyone. I would like to ask you two questions. The first problem: know A = [0.4,0.9], B = [2,9], and find the linear equation through A and B. The second problem: how to remove all zeros in a matrix. D=[1 2 3; 1 7 2; 6 2 7,0 0 0,0 0 0].

1 次查看(过去 30 天)
I would like to ask you two questions. The first problem: know A = [0.4,0.9], B = [2,9], and find the linear equation through A and B. The second problem: how to remove all zeros in a matrix. D=[1 2 3; 1 7 2; 6 2 7,0 0 0,0 0 0].

回答(1 个)

Sulaymon Eshkabilov
Question (1) is a simple LA exercise, but [A] needs to be 2-by-2. And then you can compute the roots of the system using linsolve(), ldivide(), \, etc operators.
Question (2): again the size of D is incorrectly defined. number of elements in each row has to be equal. Or D has to be row or column matrix containing some "0" elements. Once you fix this issue, you can solve the problem using logical indexing, e.g.: D(D==0) = [ ].

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by