Solving matrices in form of (A + Bx = C)?
5 次查看(过去 30 天)
显示 更早的评论
% 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.
采纳的回答
Shivang Srivastava
2020-6-19
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:
0 个评论
更多回答(0 个)
另请参阅
类别
Find more on Operating on Diagonal Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!