I've got three matrixes, one of which contains the unknowns. Two of them are multiplied by each other and result the last one.
A1 * A2 = A3
So, I've got this code in MATLAB:
syms A1 A2 A3 B C D F
k1=1; k2=2, b=3, a=4
A1 = [ -exp(i*k1*b) exp(-k2*b) exp(k2*b) 0; i*k1*exp(i*k1*b) k2*exp(-k2*b) -k2*exp(k2*b) 0; 0 -exp(-k2*a) -exp(k2*a) (exp(-i*k1*a) + exp(i*k1*a)); 0 -k2*exp(-k2*a) k2*exp(k2*a) i*k1*(exp(-i*k1*a) - exp(i*k1*a)) ]
A2 = [ B; C; D; F ]
A3 = [ exp(-i*k1*b) ; i*k1*exp(-i*k1*b) ; 0 ; 0 ]
I want to solve what's the result of B, C, D and F. I know I've got to use function solve
but I got problem with the syntax all the time.
Thanks for your time and reply...
This question has no need for any symbolic mathematics. Your A1
and A3
matrices are defined numerically. All you have to do to find the entries in A2
is to invoke the inverse operator (\
) between A1
and A3
. Specifically, if you are given:
A1 * A2 = A3 ,
to find A2
, you would do:
A2 = A1^{-1} * A3
You would find the inverse of A1
and multiply this with A3
. You can easily do this in MATLAB by the inverse operator:
A2 = A1 \ A3;
Therefore, just do this:
k1=1; k2=2; b=3; a=4;
A1 = [ -exp(i*k1*b) exp(-k2*b) exp(k2*b) 0; i*k1*exp(i*k1*b) k2*exp(-k2*b) -k2*exp(k2*b) 0; 0 -exp(-k2*a) -exp(k2*a) (exp(-i*k1*a) + exp(i*k1*a)); 0 -k2*exp(-k2*a) k2*exp(k2*a) i*k1*(exp(-i*k1*a) - exp(i*k1*a)) ]
A3 = [ exp(-i*k1*b) ; i*k1*exp(-i*k1*b) ; 0 ; 0 ]
A2 = A1 \ A3;
A2
will compute B
, C
, D
and F
for you. Just refer to the first, second, third and fourth elements of A2
respectively.