Plotting a function in a range of variable
Show older comments
I am having a problem defining a variable and plotting a function in a range of variable. I want to plot trace(Mt) in the range alpha=0:0.1:2; but Matlab is not allowing me to do it. Can anyone help me on this? The code is attached here.
syms alpha n1p = 0+1i; n1=1; n2=2; m = 10; gamma =(n1p*alpha)./n1;
beta = -1i.*log(1/16.*exp(-2i.*alpha).*(9-2.*exp(2i.*alpha)+9.*exp(4i.*alpha)+3.*(-1+exp(2i.*alpha)).*sqrt(9+14.*exp(2i.*alpha)+9.*exp(4i.*alpha))));
a = exp(1i.*alpha).*(n1+n2)./(2);
b = exp(-1i.*alpha).*(n2-n1)./(2); c = exp(1i.*alpha).*(n2-n1)./(2); d = exp(-1i.*alpha).*(n1+n2)./(2); e = (1i.*(2-m).*beta); M1= [a./n2 b./n2;c./n2 d./n2]; M2 = [a./n1 -b./n1;-c./n1 d./n1]; M1p = [(exp(1i.*gamma).*(n1p+n2)./(2.*n2)) (exp(-1i.*gamma).*(n2-n1p)./(2.*n2));(exp(1i.*gamma).*(n2-n1p)./(2.*n2)) (exp(-1i.*gamma).*(n1p+n2)./(2.*n2))]; M2p = [(exp(1i.*alpha).*(n1p+n2)./(2.*n1p)) (exp(-1i.*alpha).*(n1p-n2)./(2.*n1p));(exp(1i.*alpha).*(n1p-n2)./(2.*n1p)) (exp(-1i.*alpha).*(n1p+n2)./(2.*n1p))]; T = M2*M1; [W,D] = eig(T); X = inv(W); UN = [exp(e) 0;0 exp(-e)]; Tp = M2*M1p*M2p*M1; Tt = W*UN*X; Mt = Tt*Tp;
Accepted Answer
More Answers (0)
Categories
Find more on Annotations 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!