A vehicle comprising: a motor configured to drive the vehicle; an inverter configured to drive the motor by switching a plurality of switching elements; a battery configured to exchange power with the motor via the inverter; and an electronic control unit configured to control the inverter based on a torque command of the motor, the electronic control unit being configured to: perform first PWM control of generating a first PWM signal of the plurality of switching elements to switch the plurality of switching elements by comparing voltage commands of phases based on the torque command with a carrier voltage when a target operating point including a rotation speed and the torque command of the motor is outside a predetermined area, and select and perform second PWM control of generating a second PWM signal of the plurality of switching elements to switch the plurality of switching elements based on a modulation factor of a voltage and a voltage phase based on the torque command and the number of pulses in a predetermined period of an electrical angle of the motor or the first PWM control when the target operating point is inside the predetermined area; characterized in that the electronic control unit is further configured to: perform the first PWM control when a sudden change of the drive system is predicted, determine that the sudden change of the state of the drive system is predicted and to perform the first PWM control when an absolute value of the variation per unit time ΔVH of a voltage VH of the high-voltage power line is equal to or greater than the threshold value ΔVHref, or an absolute value of the variation per unit time ΔVB of voltage VB of the battery is equal to or greater than the a threshold value ΔVBref. a motor configured to drive the vehicle; an inverter configured to drive the motor by switching a plurality of switching elements; a battery configured to exchange power with the motor via the inverter; and an electronic control unit configured to control the inverter based on a torque command of the motor, the electronic control unit being configured to: perform first PWM control of generating a first PWM signal of the plurality of switching elements to switch the plurality of switching elements by comparing voltage commands of phases based on the torque command with a carrier voltage when a target operating point including a rotation speed and the torque command of the motor is outside a predetermined area, and select and perform second PWM control of generating a second PWM signal of the plurality of switching elements to switch the plurality of switching elements based on a modulation factor of a voltage and a voltage phase based on the torque command and the number of pulses in a predetermined period of an electrical angle of the motor or the first PWM control when the target operating point is inside the predetermined area; characterized in that the electronic control unit is further configured to: perform the first PWM control when a sudden change of the drive system is predicted, determine that the sudden change of the state of the drive system is predicted and to perform the first PWM control when an absolute value of the variation per unit time ΔVH of a voltage VH of the high-voltage power line is equal to or greater than the threshold value ΔVHref, or an absolute value of the variation per unit time ΔVB of voltage VB of the battery is equal to or greater than the a threshold value ΔVBref. perform first PWM control of generating a first PWM signal of the plurality of switching elements to switch the plurality of switching elements by comparing voltage commands of phases based on the torque command with a carrier voltage when a target operating point including a rotation speed and the torque command of the motor is outside a predetermined area, and select and perform second PWM control of generating a second PWM signal of the plurality of switching elements to switch the plurality of switching elements based on a modulation factor of a voltage and a voltage phase based on the torque command and the number of pulses in a predetermined period of an electrical angle of the motor or the first PWM control when the target operating point is inside the predetermined area; characterized in that the electronic control unit is further configured to: perform the first PWM control when a sudden change of the drive system is predicted, determine that the sudden change of the state of the drive system is predicted and to perform the first PWM control when an absolute value of the variation per unit time ΔVH of a voltage VH of the high-voltage power line is equal to or greater than the threshold value ΔVHref, or an absolute value of the variation per unit time ΔVB of voltage VB of the battery is equal to or greater than the a threshold value ΔVBref. perform the first PWM control when a sudden change of the drive system is predicted, determine that the sudden change of the state of the drive system is predicted and to perform the first PWM control when an absolute value of the variation per unit time ΔVH of a voltage VH of the high-voltage power line is equal to or greater than the threshold value ΔVHref, or an absolute value of the variation per unit time ΔVB of voltage VB of the battery is equal to or greater than the a threshold value ΔVBref.