if 0
    M=pmsm_estim_mex('Mz_mx.cfg');
    save Mz M
else
    load Mz
end

time = 0.000125*[0:size(M.crbzth,1)-1];

figure(1)
subplot(2,1,1);
plot(time,M.xom);
grid on
title('Simulated rotor speed profile');

subplot(2,1,2);
hold off
plot(time,M.crbzth);
hold on
plot(time,M.crbth,'r--');
grid on
legend('EKF TL','EKF')
title('Cramer-Rao bounds on rotor position')

figure(2)
hold off
plot(time,M.crbzom);
hold on
plot(time,M.crbom,'r');

ind=100:size(M.crbth,1)-100;
[min(M.crbom(ind)), max(M.crbom(ind))]
[min(M.crbzom(ind)), max(M.crbzom(ind))]

