I want to solve a problem with just numbers from 0 to 2, how do I do that?

1 回表示 (過去 30 日間)
Roberto García Morones
Roberto García Morones 2020 年 11 月 30 日
I'm doing a homework that consists of making a matrix according to these steps:
t= [0;1;2]
A= [1;1;0];
B= [1;1;1];
C= [0;1;1];
M= [A B C t]
sol= rref(M)
The thing is that I want to get a matrix that gives me values from 0 to 2. However, I don't get the correct answer since it gives me this:
sol =
1 0 0 1
0 1 0 1
0 0 1 1
Correct answer:
sol =
1 0 0 2
0 1 0 1
0 0 1 1
  2 件のコメント
the cyclist
the cyclist 2020 年 11 月 30 日
MATLAB gives
sol =
1 0 0 -1
0 1 0 1
0 0 1 1
right?
Roberto García Morones
Roberto García Morones 2020 年 11 月 30 日
Yes, I forgot to put abs(rref(M))

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

回答 (1 件)

the cyclist
the cyclist 2020 年 11 月 30 日
Are you sure you copied everything from the assignment correctly? Can you post the text of the assignment here?
I did the Gauss-Jordan elimination with partial pivoting by hand, and get same result as MATLAB.
  4 件のコメント
Roberto García Morones
Roberto García Morones 2020 年 11 月 30 日
A little bit, in your case how would you code it so it gives me this solution?
sol =
1 0 0 2
0 1 0 1
0 0 1 1
Roberto García Morones
Roberto García Morones 2020 年 11 月 30 日
Nevermind, I already did it. Thank you so much!

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

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by