Interested in Field-Oriented Control (FOC) and motor solutions? Then check out this solution from MathWorks on how to implement closed-loop FOC to regulate speed and torque of a three-phase Permanent Magnet Synchronous Motor (PMSM).
This project takes advantage of the Texas Instrument's TMS320F28027 LaunchPad (LAUNCHXL-F28027) and DRV8301 BoosterPack (BOOSTXL-DRV8301) to get your motor spinning.
http://www.mathworks.com/matlabcentral/fileexchange/45124-motor-control-with-ti-launchpad