This paper demonstrates the fundamental principle systematically , including the design process of a halbach motor . in order to make the design more easier and reduce the designing period , cad is applied to the motor design : the concise matlab language , to some extend , reduces the workload in electromagnetism design ; the mathematic modeling and collating programs compiled by apdl language in ansys substantiate the precision of the electromagnetism design 为了减少电机设计的工作量和缩短电机开发的周期,本课题对halbach电机采用计算机辅助设计:简洁的matlab语言在一定程度上减少了halbach电机电磁设计的工作量,缩短了电机开发的周期;利用ansys自带的apdl语言编写的halbach电机建模与校核程序保证了电磁设计的准确性。