Solving matrices in form of (A + Bx = C)?

3 visualizaciones (últimos 30 días)
Keith Grey
Keith Grey el 15 de Jun. de 2020
Respondida: Shivang Srivastava el 19 de Jun. de 2020
% How do I write to solve for y?
A = [1 2; 3 4];
B = [0 0; 1 1];
y = [x1; x2];
C = [1; 0];
% y should be a 2x1, but I'm getting a 2x2.
  2 comentarios
Ameer Hamza
Ameer Hamza el 15 de Jun. de 2020
Is the equation correct? A is 2x2, B is 2x2, and y is 2x1. A cannot be added to B*x.
madhan ravi
madhan ravi el 15 de Jun. de 2020
Exactly I second Ameer’s comment.

Iniciar sesión para comentar.

Respuesta aceptada

Shivang Srivastava
Shivang Srivastava el 19 de Jun. de 2020
As per my understanding of your code, in the equation A + Bx = C:
Matrix A is of size 2 * 2
Matrix B is of size 2 * 2
Matric C is of size 2 * 1
So when you are trying to perform the operations because of size mismatch of A, C & B*y your answer is evaluated to be a 2*2 matrix.
You can check the following code snippet for a better understanding of this:
A = [1 2; 3 4];
B = [0 0; 1 1];
C = [1; 0];
y = (C - A)\B
If you still face any difficulty you can refer to the following documentations:

Más respuestas (0)

Categorías

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

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by