In order to obtain a highly reliable image with no image distortion or no artifacts, such as ghosting, by compensating for the distortion of an output gradient magnetic field waveform caused by various factors with high accuracy, an input gradient magnetic field waveform and an output gradient magnetic field waveform corresponding to the input gradient magnetic field waveform are calculated, a response function that is a sum of response functions of a plurality of elements affecting the output gradient magnetic field waveform is calculated using the input gradient magnetic field waveform and the output gradient magnetic field waveform, an output gradient magnetic field waveform is calculated from an input gradient magnetic field waveform of a gradient magnetic field pulse set in the imaging sequence using the response function, and various kinds of correction are performed using the calculated value of the calculated output gradient magnetic field waveform.