A controller for a motor comprising: a basic voltage command calculation unit configured to calculate a voltage command basic value; a current detection unit configured to detect a current flowing through a winding of a motor; a magnetic flux estimation unit configured to estimate an interlinkage flux interlinked to the winding, based on an applied voltage applied to the winding and a detection value of the current; a torque estimation unit configured to estimate an output torque (Te) of the motor, based on the detection value of the current and an estimation value of the interlinkage flux; a pulsation extraction unit configured to extract a pulsation component from an estimation value of the output torque (Te); a pulsation control unit configured to calculate a voltage command correction value (Vc), based on an extraction value of the pulsation component (Te); a superimposing unit configured to calculate a voltage command after superimposing by superimposing the voltage command correction value (Vc) on the voltage command basic value; a voltage application unit configured to apply voltage to the winding, based on the voltage command after superimposing; wherein the pulsation extraction unit is configured to calculate Fourier coefficients (an, bn) of a cosine wave and a sine wave by Fourier-transforming the estimation value of the output torque (Te) at a pulsation frequency of a preliminarily set rotation order (n), based on a rotational angle (Θ) of the motor, and to calculate the Fourier coefficients (an, bn) of the cosine wave and the sine wave, as the extraction value of the pulsation component (Te); and wherein the pulsation control unit is configured to calculate a cosine wave multiplication value (Ya) by multiplying a cosine wave of the pulsation frequency of the rotation order (n) to the Fourier coefficient (an) of the cosine wave, to calculate a sine wave multiplication value (Yb) by multiplying a sine wave of the pulsation frequency of the rotation order (n) to the Fourier coefficient (bn) of the sine wave, and to calculate a value obtained by multiplying a control gain (Kv) to a total value (Yab) of the cosine wave multiplication value (Ya) and the sine wave multiplication value (Yb), as the voltage command correction value (Vc), to calculate a phase delay (Δθd) due to calculation delay, based on the rotational angle (Θ) of the motor, and to calculate the cosine wave of the pulsation frequency of the rotation order (n) and the sine wave of the pulsation frequency of the rotation order (n) in which the phase delay (Δθd) is compensated. a basic voltage command calculation unit configured to calculate a voltage command basic value; a current detection unit configured to detect a current flowing through a winding of a motor; a magnetic flux estimation unit configured to estimate an interlinkage flux interlinked to the winding, based on an applied voltage applied to the winding and a detection value of the current; a torque estimation unit configured to estimate an output torque (Te) of the motor, based on the detection value of the current and an estimation value of the interlinkage flux; a pulsation extraction unit configured to extract a pulsation component from an estimation value of the output torque (Te); a pulsation control unit configured to calculate a voltage command correction value (Vc), based on an extraction value of the pulsation component (Te); a superimposing unit configured to calculate a voltage command after superimposing by superimposing the voltage command correction value (Vc) on the voltage command basic value; a voltage application unit configured to apply voltage to the winding, based on the voltage command after superimposing; wherein the pulsation extraction unit is configured to calculate Fourier coefficients (an, bn) of a cosine wave and a sine wave by Fourier-transforming the estimation value of the output torque (Te) at a pulsation frequency of a preliminarily set rotation order (n), based on a rotational angle (Θ) of the motor, and to calculate the Fourier coefficients (an, bn) of the cosine wave and the sine wave, as the extraction value of the pulsation component (Te); and wherein the pulsation control unit is configured to calculate a cosine wave multiplication value (Ya) by multiplying a cosine wave of the pulsation frequency of the rotation order (n) to the Fourier coefficient (an) of the cosine wave, to calculate a sine wave multiplication value (Yb) by multiplying a sine wave of the pulsation frequency of the rotation order (n) to the Fourier coefficient (bn) of the sine wave, and to calculate a value obtained by multiplying a control gain (Kv) to a total value (Yab) of the cosine wave multiplication value (Ya) and the sine wave multiplication value (Yb), as the voltage command correction value (Vc), to calculate a phase delay (Δθd) due to calculation delay, based on the rotational angle (Θ) of the motor, and to calculate the cosine wave of the pulsation frequency of the rotation order (n) and the sine wave of the pulsation frequency of the rotation order (n) in which the phase delay (Δθd) is compensated.