Some parts are commented in Polish. Sorry for that :) If you need a similar solution for an AC drive please see http://ufnalski.edu.pl/dissertation/ -- also in Polish :) You might be also interested in http://www.mathworks.com/matlabcentral/fileexchange/57351-extended-kalman-filter-for-speed-sensorless-ac-motor-drive .
Modeling of the system (=process) noise corrected. A huge thanks goes to my colleague Arkadiusz Kaszewski for pointing this out.
Info on EKF added.
Create scripts with code, output, and formatted text in a single executable document.