How to simplify a symbolic matrix
Show older comments
Hello everyone,
I was trying the following code:
clc
clear all
close all
syms a k1 k2;
A=[exp(-i*k1*a) 0; 0 exp(i*k1*a)];
B=[k2+k1 k1-k2; k1-k2 k2+k1];
C=[exp(i*k2*a) 0; 0 exp(-i*k2*a)];
D=[exp(i*k2*a) 0; 0 exp(-i*k2*a)];
E=[k2+k1 k2-k1; k2-k1 k2+k1];
F=[exp(-i*k1*a) 0; 0 exp(i*k1*a)];
T=((((A*B)*C)*D)*E)*F;
T=T/(4*k1*k2);
T=simplify(T);
fprintf('T11=\n%s \n',char(T(1,1)));
fprintf('T12=\n%s \n',char(T(1,2)));
fprintf('T21= \n%s \n',char(T(2,1)));
fprintf('T22= \n%s \n',char(T(2,2)));
In this code, i am trying to evaluate T matrix;
I want to simplify the individual components of T matrix {i.e., T(1,1) , T(1,2) , T(2,1) & T(2,2) }
I searched it on internet and found "simplify" will perform the above task.
But , for the above code, the result is yet unsimplified,
i.e., i am getting T(1,1) output as
(exp(a*k1*(-i))*(exp(a*k1*(-i))*exp(a*k2*(2*i))*(k1 + k2)^2 - exp(a*k1*(-i))*exp(a*k2*(-2*i))*(k1 - k2)^2))/(4*k1*k2)
i.e., 
but we can see that
from the inner bracket
can be further taken out to simplify the result ;
hence how to simplify the results of the above code?
Accepted Answer
More Answers (0)
Categories
Find more on Mathematics 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!