You are on page 1of 2

MATLAB Command Window Page 1

>> [ox,oy,oz] = getpaulimatricies()

ox =

0 1
1 0

oy =

0.0000 + 0.0000i 0.0000 - 1.0000i


0.0000 + 1.0000i 0.0000 + 0.0000i

oz =

1 0
0 -1

>> syms B theta


>> syms t w
>> H = B*cos(w*t)*(kron(ox,eye(2))+kron(eye(2),ox)) + B*cos(w*t)*(kron(oy,eye(2))
+kron(eye(2),oy));
>> H

H =

[ 0, B*cos(t*w)*(1 - 1i), B*cos(t*w)*(1 - 1i), 0]


[ B*cos(t*w)*(1 + 1i), 0, 0, B*cos(t*w)*(1 - 1i)]
[ B*cos(t*w)*(1 + 1i), 0, 0, B*cos(t*w)*(1 - 1i)]
[ 0, B*cos(t*w)*(1 + 1i), B*cos(t*w)*(1 + 1i), 0]

>> T=[1,0,0,0;0,cos(theta),-sin(theta),0;0,sin(theta), cos(theta),0;0,0,0,1];


>> Rz = kron(expm(0.5i*w*t*oz),eye(2))*kron(eye(2),expm(0.5i*w*t*oz))
Rz

Rz =

[ exp(t*w*1i), 0, 0, 0]
[ 0, 1, 0, 0]
[ 0, 0, 1, 0]
[ 0, 0, 0, exp(-t*w*1i)]

Rz =

[ exp(t*w*1i), 0, 0, 0]
[ 0, 1, 0, 0]
[ 0, 0, 1, 0]
[ 0, 0, 0, exp(-t*w*1i)]

>> Tz
Undefined function or variable 'Tz'.

>> T
MATLAB Command Window Page 2

T =

[ 1, 0, 0, 0]
[ 0, cos(theta), -sin(theta), 0]
[ 0, sin(theta), cos(theta), 0]
[ 0, 0, 0, 1]

>> trans=T*Rz

trans =

[ exp(t*w*1i), 0, 0, 0]
[ 0, cos(theta), -sin(theta), 0]
[ 0, sin(theta), cos(theta), 0]
[ 0, 0, 0, exp(-t*w*1i)]

>> trans*H*inv(trans)

ans =

[ 0,
(B*exp(t*w*1i)*cos(t*w)*cos(theta)*(1 - 1i))/(cos(theta)^2 + sin(theta)^2) + (B*exp
(t*w*1i)*cos(t*w)*sin(theta)*(- 1 + 1i))/(cos(theta)^2 + sin(theta)^2), (B*exp
(t*w*1i)*cos(t*w)*cos(theta)*(1 - 1i))/(cos(theta)^2 + sin(theta)^2) + (B*exp(t*w*1i)
*cos(t*w)*sin(theta)*(1 - 1i))/(cos(theta)^2 + sin(theta)^2),
0]
[ exp(-t*w*1i)*(B*cos(t*w)*cos(theta)*(1 + 1i) - B*cos(t*w)*sin(theta)*(1 + 1i)),
0,
0, exp(t*w*1i)*(B*cos(t*w)*cos(theta)*(1 - 1i) - B*cos(t*w)*sin(theta)*(1 - 1i))]
[ exp(-t*w*1i)*(B*cos(t*w)*cos(theta)*(1 + 1i) + B*cos(t*w)*sin(theta)*(1 + 1i)),
0,
0, exp(t*w*1i)*(B*cos(t*w)*cos(theta)*(1 - 1i) + B*cos(t*w)*sin(theta)*(1 - 1i))]
[ 0,
(B*exp(-t*w*1i)*cos(t*w)*cos(theta)*(1 + 1i))/(cos(theta)^2 + sin(theta)^2) + (B*exp
(-t*w*1i)*cos(t*w)*sin(theta)*(- 1 - 1i))/(cos(theta)^2 + sin(theta)^2), (B*exp(-
t*w*1i)*cos(t*w)*cos(theta)*(1 + 1i))/(cos(theta)^2 + sin(theta)^2) + (B*exp(-t*w*1i)
*cos(t*w)*sin(theta)*(1 + 1i))/(cos(theta)^2 + sin(theta)^2),
0]

>>

You might also like