• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC Design
  3. How to extract a specific fft bin with the calculator?

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 125
  • Views 17804
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to extract a specific fft bin with the calculator?

pepijndevos
pepijndevos over 5 years ago

I have set up an ADE XL sweep over input frequency for my circuit, and I would like to comput the magnitude of the signal at the output at that specific frequency.  The reason is that I want to find the transfer function of a time-dependant circuit that can't be simulated with AC or PAC.

So far I managed to take the RMS, but this will include noise in the output. Of course I can take the FFT in the calculator, but from there I'm missing a crucial step: take the magnitue of the FFT bin corresponding to the input frequency set by ADE XL.

  • Cancel
  • ShawnLogan
    ShawnLogan over 5 years ago

    Dear pepijndevos,

    I think there are a number of issues "buried" in your question to consider based on your question...an "introductory" set of responses that I hope help follow...

    First, recall that in general the dft() function is complex, so indeed if you just want the magnitude at a specific frequency, you can use the value() function. The first argument is the dft() function and the second is the input frequency. The value function provides an option to interpolate or round down the second entry when it evaluates the first argument (see its arguments in Figure 1).

    However, to prevent spectral leakage, where your amplitude may "spill" over into more than one bin, you need to specify an exact number periods of the input frequency for the dft() time period. Otherwise, depending on the windowing method you choose for the dft(), you will observe that the amplitude of your input frequency will occupy multiple frequency bins.

    In addition, depending on the accuracy you need, you may need to use the transient analysis option "strobeperiod" to set the output time points to the exact times required by the dft(). For example, if you are doing a 32768 point dft() over 32.768 ns, set the strobeperiod to 32.768 ns/32,768. This avoids the need for the dft() to interpolate the values at the times you specify.

    An example of the dft() is shown below in Figure 1 of two summed tones at node vout at frequencies of 5 GHz and 10/3 GHz with amplitudes of 500 mVpp and 200 mVpp  respectively. The two sine waves are summed through a passive summer (see Figure 2, res_ohms = 50). The dft is performed over an integral number of 5 GHz periods and its amplitude all falls into one frequency bin. Its single-bin amplitude is shown as about 84 mV.  However, there are not an integral number of periods of the 10/3 GHz sine wave and its amplitude is not contained in a single bin. Hence, in your case where you apply an single input frequency (that may produce intemods in your circuit), the time interval for the dft() should correspond to an integral number of periods as you sweep the input frequency. Further, the frequency of any intermodulation products your circuit produce will likely not contain an integral number of periods for the dft() analysis period. Hence, some of their power may spill over into your main frequency bin - resulting in some error.

    In summary, although your concept appears simple, there are numerous factors to consider to provide an accurate transfer function....hope this helps to some extent! My apologies if these issues are already evident to you!

    Shawn

    Figure 1

    Figure 2

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 5 years ago in reply to ShawnLogan

    Thanks Shawn for this response. I was going to suggest the value() function too - but with a fallback that if you really wanted to access it by bin number, that would need a custom function (not hard to write, but I wasn't going to spend the time doing it until there was a good reason why value wouldn't suffice).

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • pepijndevos
    pepijndevos over 5 years ago in reply to ShawnLogan

    Thank you for the elaborate reply. While I am aware of the issues of the dft, I did not stop to consider it in this scenario yet, and was just going to apply a window function and prey.

    One problem not addressed in your answer is how I can adjust the number of FFT bins and the value frequency argument to match the frequency used in the parameter sweep. Can I use the ADE variables directly in the calculator somehow?

    For example, in the run at 2.35GHz I would need to do something like value(dft(node, 2350), 2.35G) and for 2.45 it'd be something like value(dft(node, 2450), 2.45G), right?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 5 years ago in reply to pepijndevos

    Dear pepijndevos,

    ➢ Can I use the ADE-L variables directly in the calculatorsomehow?

    Yes. A design variable can be included in a Calculator expression (or an ADE-L/ADE-XL/Assembler expression) by referring to the variable as a text string in the VAR() function. In the example I described, the end time of my simulation was defined as a variable “tstop” that is set to 100/(1e9*freq1_GHz). freq1_GHz is a variable that defines one of the two frequencies I used in the passive summer. I performed a series of simulations where I varied freq1_GHz from 0.1 to 10 and plotted the value() function as a function of freq1_GHz and attached the result. In my dft() expression, I used the period of freq1_GHz to set the dft analysis to 40 periods to avoid spectral leakage. I think this is similar to what you were attempting to simulate. If it helps, I’ve attached a comma separated file of ADE-L outputs that you can import into ADE-L or just copy either of the expressions into ADE-XL/Assembler. Let me know if I’ve managed to confuse you or if you have any questions.

     

    Shawn

    ——————————

    Name,Type,Output,Plot,Save

    ,net,/vout,,t

    ,net,/gnd!,,t

    ,net,/vsin2,,t

    ,net,/vsin1,,t

    fft,expr,dft(v("/vout" ?result "tran") (50 / (1e+09 * VAR("freq1_GHz"))) (100 / (1e+09 * VAR("freq1_GHz"))) 32768 "Rectangular" 1 "default" 1.0),t,

    mag_fft_value_at_freq1_GHz,expr,value(mag(dft(v("/vout" ?result "tran") (50 / (1e+09 * VAR("freq1_GHz"))) (100 / (1e+09 * VAR("freq1_GHz"))) 32768 "Rectangular" 1 "default" 1.0)) 1e9*VAR("freq1_GHz")),t,

    ———————

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information