Why isn't my matrix correct?

7 visualizaciones (últimos 30 días)
Jenny Andersen
Jenny Andersen el 30 de Dic. de 2019
Editada: KALYAN ACHARJYA el 30 de Dic. de 2019
So I am trying to solve for x in Mx = d, but I only get a 3*2 matrix. I should get a 3*3 matrix. What am I doing wrong?
A = [1 0; 2 2; 4 3; 5 4]
b = [0;2;5;7]
M = A.' *A;
d = A.' *b;
x = A\b;
disp(x)

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 30 de Dic. de 2019
Editada: KALYAN ACHARJYA el 30 de Dic. de 2019
You are trying to solve x, Ax=b, where A and b is given (There is no role of M and D as per your code)
A = [1 0; 2 2; 4 3; 5 4]
b = [0;2;5;7]
x = A\b;
disp(x)
The solution is
0.5000
1.0000
Now you can verify the solution through manual also by creating agumented matrix, thereafter row echelon form or using Matlab also. Here is the very simple article (2nd page) of those steps
>> result=[A,b] % Agumented matrix
result =
1 0 0
2 2 2
4 3 5
5 4 7
>> rref(result) % Row echelon form
ans =
1 0 0
0 1 0
0 0 1
0 0 0
There after please go to find a solution just a combination of pivot columns. Please, firstly go for Maths undesranding, then only proceed towards Matlab.
Hope it helps!

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by