activeX[
            u_] := {{1,  0,  0}, {0,  Cos[u],  -Sin [u]}, {0,  
              Sin [u],  Cos[u]}}; 
        activeY[u_] := {{ Cos[u], 0,  Sin [u]}, {0,  1,  
              0}, {-Sin [u], 0,   Cos[u]}};
activeZ[
              u_] := {{Cos[u],  -Sin [u],  0}, {Sin [u],  Cos[u], 
                0 },  {0,  0,  1}};

MatrixForm[activeX[a]]
MatrixForm[activeY[a]]
MatrixForm[activeZ[a]]

  
  
Xpulse = 
            activeY[-Pi/2 + th] . activeX[-fAng] . 
              activeY[Pi/2 - th];
Print["X-pulse matrix:"]
MatrixForm[Xpulse]

  
  
Ypulse = 
            activeX[Pi/2 - th] . activeY[-fAng2] . 
              activeX[-Pi/2 + th];
Print["Y-pulse matrix:"]
MatrixForm[Ypulse]

  
  
compositePulse = Ypulse . Xpulse;

Print["xcomponent of X(t)Y(tau)-spinlock \
pulse:"]

Mxvector  =  
          FullSimplify[compositePulse[[1 , 3]]]

xComponent[db0_]  =  
            Mxvector  /.  {
Cos[th]  ->  
                  db0/Sqrt[b1*b1 + db0*db0], 
Sin[
                    th]  -> 
                  b1/Sqrt[
                      b1*b1 + db0*db0], 
fAng  ->  
                  2  Pi*t*
                    Sqrt[b1*b1 + db0*db0], 
fAng2 ->  
                  2  Pi*tau*Sqrt[b1*b1 + db0*db0]
};

Print["ycomponent of X(t)Y(tau)-spinlock \
pulse:"]

Myvector  =  
          FullSimplify[compositePulse[[2 , 3]]]

yComponent[db0_]  =  
            Myvector  /.  {
Cos[th]  ->  
                  db0/Sqrt[b1*b1 + db0*db0], 
Sin[
                    th]  -> 
                  b1/Sqrt[
                      b1*b1 + db0*db0], 
fAng  ->  
                  2  Pi*t*
                    Sqrt[b1*b1 + db0*db0], 
fAng2 ->  
                  2  Pi*tau*Sqrt[b1*b1 + db0*db0]
};

Print["zcomponent of X(t)Y(tau)-spinlock \
pulse:"]

Mzvector  =  
          FullSimplify[compositePulse[[3 , 3]]]

zComponent[db0_]  =  
            Mzvector  /.  {
Cos[th]  ->  
                  db0/Sqrt[b1*b1 + db0*db0], 
Sin[
                    th]  -> 
                  b1/Sqrt[
                      b1*b1 + db0*db0], 
fAng  ->  
                  2  Pi*t*
                    Sqrt[b1*b1 + db0*db0], 
fAng2 ->  
                  2  Pi*tau*Sqrt[b1*b1 + db0*db0]
};

  
Print["-----------------------------------------------"]

  

b1 = 50;           
t = 0.005;       
tau = 0.005;  
nb = 70;           

For[m = 0,  
            m  <=  nb,  m++,  offset[m] = m; ];
offsetValue  =  
            Chop[Table[{off,  
                  offset[off],  
NumberForm[
                    xComponent[off],  10] , 
NumberForm[
                    yComponent[off],  10], 
NumberForm[
                    zComponent[off],  10]},  {off,  0,  nb}]];
\(Print[
          TableForm[offsetValue, \ 
            TableHeadings\  -> \ {None, \ {Rang, \ 
                  offset/kHz, "xMagnetization", \ "yMagnetization", \ "zMagnetization"\ }}]]\)
Print["-----------------------------------------------"]

  

b1 = 50;           
t = 0.005;       
tau = 0.005;  
nb = 70;           

\(plotSpinlockx\  = \ 
            ListPlot[
              Table[{off, \ xComponent[off]}, \ {off, \ 0, \ 
                  nb}], 
PlotLabel\  -> \ "xComponent spinlock pulse", 
PlotJoined\  -> \ 
                True, 
AxesLabel\  -> \ {"Offset (kHz)", \ \ "Mx"}, 
PlotStyle -> {Hue[ .1], \ 
                  Thickness[
                    0.005]}, 
TextStyle\  -> \ {FontSize\  -> \ 12}
]\)

\(plotSpinlocky\  = \ 
          ListPlot[
            Table[{off, \ yComponent[off]}, \ {off, \ 0, \ 
                nb}], 
PlotLabel\  -> \ "yComponent spinlock pulse", 
PlotJoined\  -> \ 
              True, 
AxesLabel\  -> \ {"Offset (kHz)", \ \ "My"}, 
PlotStyle -> {Hue[ .3], \ 
                Thickness[
                  0.005]}, 
TextStyle\  -> \ {FontSize\  -> \ 12}
]\)

\(plotSpinlockz\  = \ 
          ListPlot[
            Table[{off, \ zComponent[off]}, \ {off, \ 0, \ 
                nb}], 
PlotLabel\  -> \ "zComponent spinlock pulse", 
PlotJoined\  -> \ 
              True, 
AxesLabel\  -> \ {"Offset (kHz)", \ \ "Mz"}, 
PlotStyle -> {Hue[ .5], \ 
                Thickness[
                  0.005]}, 
TextStyle\  -> \ {FontSize\  -> \ 12}
]\)

\(Show[{plotSpinlockx, \ plotSpinlocky, \ 
            plotSpinlockz}, 
PlotLabel\  -> \ "spin lock 90°(X) 90°(y)-detection", \ 
AxesLabel\  -> \ {"Offset (kHz)", \ \ "Mi"}
]\)

Remove[xComponent, yComponent, zComponent,  
            Mxvector,  Myvector, Mzvector, activeX,  activeY,  activeZ,  
            Xpulse, Ypulse,  offsetValue,  offset,  off,  nb,  t,  
            tau,  b1,  th,  fAng,  fAng2 ];