 set(groot,'DefaultTextInterpreter','latex','DefaultLegendInterpreter','latex'),
 set(groot,'DefaultAxesFontName','Times','DefaultAxesFontSize',12),
%
 P = tf(1,[1 .1 1]);
%
 epss = 0.1;
 mum  = 1/2;
 w0 = .2;
 n = 2;
 Ws = tf([0.5 5.47342*w0 29.9583*w0^2],[1 2.44779*w0 2.99583*w0^2]);
%
 kap = 10;
 w1 = 2.4;
 w2 = 1000*w1;
 Wk = tf([1/w1 1],kap*[1/w2 1]);
%
 [gamma,C0] = msens(P,Ws,Wk);
 [zC,pC,kC] = zpkdata(C0,'v');
 C = zpk(zC(2:end),pC(2:end),kC*zC(1)/pC(1));
%%
 S = feedback(1,P*C);
 w = logspace(-1.5,2.5,1001);
 [mS,phS] = bode(S,w); mS = mag2db(squeeze(mS));
 [mWs,phS] = bode(1/Ws,w); mWs = mag2db(squeeze(mWs));
 clear phS,
 figure(1),
 semilogx(w,mWs,'LineWidth',1.5,'Color',([.2,.2,.7]+[1,1,1])/2)
 hold on,
 semilogx(w,mS,'LineWidth',3,'Color',[.2,.2,.7])
 hold off,
 grid on,
 axis([w(1) w(end) mag2db(epss)-2 mag2db(1/mum)+1]),
 set(gca,'FontSize',14,'TickLabelInterpreter','latex'),
 set(gca,'XTick',sort([0.1 1 10 100 w0 w1]),'XTickLabel',{'$10^{-1}$','$\omega_0$','$10^0$','$\omega_1$','$10^1$','$10^2$'}),
 set(gca,'YTick',sort(round([0 mag2db(epss) mag2db(1/mum) max(mS)]))),
 xlabel('Frequency (rad/sec)'),
 ylabel('Magnitude (dB)'),
 lgdT = [{'$\ 1/|W_\sigma(\mathrm j\omega)|$','$\ |S(\mathrm j\omega)|$'}];
 lgd = legend(lgdT,'Location','SouthEast','FontSize',18);
%  print -depsc MSex1S
%%
 Tc = feedback(C,P);
 w = logspace(-1.5,2.5,1001);
 [mTc,phS] = bode(Tc,w); mTc = mag2db(squeeze(mTc));
 [mWk,phS] = bode(1/Wk,w); mWk = mag2db(squeeze(mWk));
 clear phS,
 figure(2),
 semilogx(w,mWk,'LineWidth',1.5,'Color',([.2,.2,.7]+[1,1,1])/2)
 hold on,
 semilogx(w,mTc,'LineWidth',3,'Color',[.2,.2,.7])
 hold off,
 grid on,
 axis([w(1) w(end) -22 mag2db(kap)+2]),
 set(gca,'FontSize',14,'TickLabelInterpreter','latex'),
 set(gca,'XTick',sort([0.1 1 10 100 w0 w1]),'XTickLabel',{'$10^{-1}$','$\omega_0$','$10^0$','$\omega_1$','$10^1$','$10^2$'}),
 set(gca,'YTick',sort(round([-20 0 mag2db(kap) max(mTc)]))),
 xlabel('Frequency (rad/sec)'),
 ylabel('Magnitude (dB)'),
 lgdT = [{'$\ 1/|W_\kappa(\mathrm j\omega)|$','$\ |T_{\mathrm c}(\mathrm j\omega)|$'}];
 lgd = legend(lgdT,'Location','NorthEast','FontSize',18);
%  print -depsc MSex1Tc
%%
 w = logspace(-1.5,2.5,501);
 T = feedback(P*C,1);
 [mT,phS] = bode(T,w); mT = mag2db(squeeze(mT));
 clear phS,
 figure(3),
 semilogx(w,mT,'LineWidth',3,'Color',[.2,.2,.7])
 grid on,
 axis([w(1) w(end) -62 4]),
 set(gca,'FontSize',14,'TickLabelInterpreter','latex'),
 set(gca,'XTick',sort([0.1 1 10 100 w0 w1]),'XTickLabel',{'$10^{-1}$','$\omega_0$','$10^0$','$\omega_1$','$10^1$','$10^2$'}),
 set(gca,'YTick',sort(round([-60 -40 -20 0]))),
 xlabel('Frequency (rad/sec)'),
 ylabel('Magnitude (dB)'),
 lgdT = '$\ |T(\mathrm j\omega)|$';
 lgd = legend(lgdT,'Location','NorthEast','FontSize',18);
%  print -depsc MSex1T
%%
 w = logspace(-1.5,2.5,801);
 Td = feedback(P,C);
 [mTd,phS] = bode(Td,w); mTd = mag2db(squeeze(mTd));
 [mP,phS] = bode(P,w); mP = mag2db(squeeze(mP));
 clear phS,
 figure(4),
 semilogx(w,mP,'LineWidth',1.5,'Color',([.2,.2,.7]+[1,1,1])/2)
 hold on,
 semilogx(w,mTd,'LineWidth',3,'Color',[.2,.2,.7])
 hold off,
 grid on,
 axis([w(1) w(end) -62 mag2db(kap)+2]),
 set(gca,'FontSize',14,'TickLabelInterpreter','latex'),
 set(gca,'XTick',sort([0.1 1 10 100 w0 w1]),'XTickLabel',{'$10^{-1}$','$\omega_0$','$10^0$','$\omega_1$','$10^1$','$10^2$'}),
 set(gca,'YTick',sort(round([-60 -40 -20 0 max(mTd)]))),
 xlabel('Frequency (rad/sec)'),
 ylabel('Magnitude (dB)'),
 lgdT = [{'$\ |P(\mathrm j\omega)|$','$\ |T_{\mathrm d}(\mathrm j\omega)|$'}];
 lgd = legend(lgdT,'Location','NorthEast','FontSize',18);
%  print -depsc MSex1Td
