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
↧