The output cavity with abrupt changes in radius for gyroklystron is studied using the mode-matching technique to build scattering matrix. A FORTRAN code is developed to calculate the scattering matrix. The effects of the cavity’s length and radius, the coupling aperture’s radius and thickness on the resonance characteristics of output cavity for Ka-band TE01 gyroklystron are analyzed. At the same time, the high frequency field distribution in the cavity is presented. The simulation result of output cavity obtained by the code shows good agreement with HFSS code simulation. Comparing the simulation result with the cold-test experimental result, the difference of quality factor is only 1.65% and the deviation of resonance frequency is 10 MHz.