The present invention provides a 
pulse width modulation method suitable for a vehicle-mounted 
motor controller, comprising: taking the instructions of the 
motor controller, the state quantities of the 
motor controller and the motor as factors, and taking the temperature of the 
power switching device and the efficiency of the motor controller as factors  At least one of them is used as the optimization target, according to the relationship between the factors and the optimization target, set the weight positive / 
negative sign and 
weight value of the corresponding factor; according to each factor and the corresponding 
weight value, determine whether to adjust the 
switching frequency;  The adjustment degree is set according to the gear position. According to the sampling and operation timing of the motor controller, the 
switching frequency corresponding to each gear position is set. Finally, the 
switching frequency is adjusted to the switching frequency of the corresponding gear position according to each factor and the corresponding 
weight value.  The method aims at minimizing the 
control delay, determines the reduction degree of the switching frequency, improves the update rate of the output 
duty cycle, improves the sine degree of the output 
voltage / current, and reduces the 
harmonic content.