Solving for unknown matrix?

조회 수: 60 (최근 30일)
Andrew Poissant
Andrew Poissant 2017년 10월 16일
댓글: John D'Errico 2022년 12월 17일
I have three known matrices, and one unknown matrix that I need to solve for. The matrices are defined in the code below. The equation to find phi is G = C*phi*B. How do I solve for phi? I tried doing phi = inv(C)*G*inv(B) but C and B are not square matrices.
syms t
G = [10*exp(-t) 3*exp(-t); 0 exp(-2*t)*cos(3*t)+2/3*exp(-2*t)*sin(3*t)];
C = [13 4 1; 1 1 0];
B = [1 0; -1 1; 1 -1];

답변 (3개)

David Goodmanson
David Goodmanson 2017년 10월 26일
Hi Andrew,
I understand that you are looking for a symbolic solution, but if G were a matrix of numbers, then
phi = C\G/B
is the fastest way to find a phi that works. For your matrix dimensions, phi always has four nonzero elements, but they are not necessarily in the upper left corner of the 3x3.
As Walter has mentioned, the solution for psi is far from unique. For more solutions,
nullC = null(C)
nullBtt = null(B.').'
c1 = rand(1,3); % c1 is 1x3 vector of arbitrary constants; rand here for demo
c2 = rand(3,1); % c2 is 3x1 vector of arbitrary constants; rand here for demo
arb1 = nullC*c1;
arb2 = c2*nullBtt;
phi_new = phi + arb1 + arb2 % another solution

Walter Roberson
Walter Roberson 2017년 10월 16일
phi = sym('phi', [3 3]);
one_solution = solve(G == C*phi*B, phi(1:2,1:2));
Now one_solution.phi1_1, .phi1_2, .phi2_1, and .phi2_2 give definitions for the top left corner of phi in terms of the other entries of phi . That is, the system is underdetermined and there are an infinite number of solutions.

Zahid Ullah
Zahid Ullah 2022년 12월 17일
  댓글 수: 2
DGM
DGM 2022년 12월 17일
% Ax + B = R
A = [5 -2; 3 -2];
B = [3 5; 4 -1];
R = [7 0; 4 -8];
% solve for x
x = A\(R-B)
x = 2×2
2.0000 1.0000 3.0000 5.0000
% back-calculate R, check
R2 = A*x + B
R2 = 2×2
7.0000 0 4.0000 -8.0000
John D'Errico
John D'Errico 2022년 12월 17일
@Zahid Ullah please don't post questions as an anser to a completely different question. Learn to ask a question, not post an answer.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by