### Where To Find This Example

Select **Help > Open Examples...** from the menus and type either the example name listed above or one of the keywords below.

Or in Version 13 or higher you can open the project directly from this page using this button. Make sure to select the **Enable Guided Help** before clicking this button.

HTML |
---|

<script src="https://s3.amazonaws.com/downloads.awrcorp.com/gh/ghcommon.bas" type="text/awrscript"> </script> <button class="gh-button gh-projectopen" onclick="runAwrScript('awrGhOpenProject','Discrete_Filter_Optimization.emp')">Open Install Example</button> |

### Design Notes

__Bandpass filter using discrete variables__

** **

This project demonstrates the use of the “**stepped()”** function to discretely tune and optimize variables. Without discrete optimization, values can be assigned unrealistic values, for example a transmission line width of 32.456 mils. The approach discussed here allows the values to only be assigned discrete values.

__Overview__

The lengths, widths and spacings of the filter can be tuned and optimized over a range of discrete values defined by the stepped functions (*shown below*).

Len=stepped(100,120,1)

Wid=stepped(10,18,1)

Gap=stepped(2,10,0.5)

The arguments (x,y,z) of the stepped function f=stepped(x,y,z) are the start, stop, step values, respectively. Then, a second variable is assigned as an index into the original vectors defined with the stepped function. For example, L0=Len[15] will set L0 to a value of 114. This syntax will also display the current value from the vector. You may have to redraw the schematic to see this setting.

The schematic titled **Discrete Filter** contains the discrete variables to be optimized. Note that vector variables are defined for each parameter that will be discretely optimized. Then, the parameters themselves are set equal to a certain array index of the vector. It is the array index that changes during the optimization. The indices can also be tuned.

__Optimization__

For this example, select **Simulate->Optimize** and select the **Pointer - Robust Optimization** optimizer. Be sure the **Show all iteration**" box is check, then click **Start**. The results of the optimization can be watched in real time on the Filter Response graph. The circuit is only optimized over the range of values defined in the array. You may want to set fewer frequency points in the **Project Options** so each optimization iteration will be faster. To go back to the starting stage click **Revert > Initial **in Optimizer window.

__Filter Response Graph__

This graph shows the insertion loss and return loss for the Discrete Filter schematic.