## 3 Coupled Cavities Filter in Rectangular Waveguide
The GSM matrix of each building block had to be multimodal, because high order modes were excited inside each building block and they were not completely attenuated (and cannot be discarded) at the reference planes, which were located very near to the adjacent building blocks. Thus, the GSM elements were \(S_{ij}^{(n,m)}(f)\), with two accessing ports (i.e., with \(i=j=1,2\)), and with \(N\) and \(M\) modes considered at the input and output ports (\(n\in[1,\cdots,N]\), \(m\in[1,\cdots,M]\)). For the analysis of the coupled cavities filter, \(N=M=11\) was chosen to produce accurate results. First, the GSM of the building blocks was computed using a discrete frequency sweep of \(N_{f}=500\) points, and next all the GSM were cascaded (using, for example, the method in [20]) obtaining the frequency response of the whole filter in each one of these 500 frequency points with full accuracy. This took 2.808 s for \(R=4\) cavities, and 5.298 s for \(R=9\) cavities. To implement the fast frequency sweep, the number of discrete frequency points \(P\) had to be chosen. \(P\) had to be as small as possible to reduce the computation time at maximum, without compromising the accuracy. To properly choose the correct value for \(P\) for this type of filter, the fast frequency sweep was implemented for different values of \(P\). This means that the GSM of each building block was computed only for \(P\) points linearly spaced in the frequency band of interest, and then the spline approximation \(S_{ij}^{(n,m)}(f)\) of Equation (1) was used to estimate the frequency response of each element of the GSM in the 500 frequency points of the discrete sweep. This was extremely fast since it only required the evaluation of the cubic polynomials of Equation (2). Finally, the GSM of all the building blocks were  
Figure 2: Segmentation of the coupled cavities all-metallic filter in rectangular waveguide into simple building blocks (empty line sections and irises). cascaded and the GSM of the whole filter was obtained. The fast frequency sweep was implemented for different values of \(P\) for \(R=4\) and for \(R=9\) filter cavities. Results are shown in Tables 1 and 2. These tables list the computation time of the fast frequency sweep, the comparison with the computation time of the discrete sweep, and the mean squared error between the reflection coefficient of the fast and discrete sweep, computed as follows:  
\[\text{error}=\sum_{i=1}^{N_{f}}\frac{|S_{11}^{\text{fast}}(f_{i})-S_{11}^{ \text{discrete}}(f_{i})|^{2}}{N_{f}} \tag{14}\]  
If \(P=2\), the error was too big, and results were inaccurate. For \(P\geq 3\), the error was small enough to get very accurate results. This is because the frequency response of the irises was very flat, and it could be approximated with very few points. To illustrate this, the frequency response of some elements of the GSM for the first and second irises of the filter are plotted in Figure 3. The real and imaginary parts of these elements computed with mode matching is depicted for the 500 discrete frequency points with solid line. For comparison, the same frequency response but approximated with splines with \(P=3\) is also plotted. The three points used to compute the coefficients of the cubic polynomials of the spline approximation are depicted as big blue dots. It can appreciated that the frequency response was very flat, and that the spline interpolation was highly accurate with \(P\) as small as 3. Tables 1 and 2 also prove that the fast frequency sweep required only around 15% of the computation time required by the discrete frequency sweep. This time slightly increased as \(P\) increased, which was the reason for choosing a value of \(P\) as small as possible without compromising the accuracy. Figure 3: Comparison between accurate and approximate scattering parameters of different blocks of the coupled cavities filter (\(R=9\)), and different combinations of input and output ports and modes. Big dots show the points used for spline approximation.