fs()

Performs a time-to-frequency transform

Syntax
y = fs(x, fstart, fstop, numfreqs, dim, windowType, windowConst, tstart, tstop, interpOrder, transformMethod)

Arguments
Name Description Range Type Default Required
x Time-domain data to be transformed (-∞, ∞) real   yes
fstart starting frequency [0, ∞) real 0 † no
fstop stoping frequency [0, ∞) real 1/(2 * newdeltat) † no
numfreqs number of frequencies [1, ∞) integer (fstop-fstart)(tstop-tstart)+1 no
dim dimension to be transformed (not used currently) [1, ∞) integer highest dimension no
windowType type of window to be applied to the data [0, 9]‡ integer, string 0 no
windowConst window constant ‡ † [0, ∞) integer, real 0 no
tstart start time ‡ ‡ [0, ∞) integer, real first time point in given data no
tstop stop time ‡ ‡ [0, ∞) integer, real last time point in given data no
interpOrder Interpolation Order [1, 3]‡+‡+† integer 1 no
transformMethod Transformation method [1, 3]‡+‡+‡ integer 1 no
† If data is real, fstart = 0, fstop=1/(2*newdeltat). If data is complex, fstart = -1/(time[startIndex+2]-time[stopIndex]) and fstop=1/(time[startIndex+2]-time[stopIndex]). Where newdeltat is the new uniform timestep of the resampled data, and startIndex and stopIndex are the index of tstart and tstop.
‡ The window types and their default constants are:
0 = None
1 = Hamming 0.54
2 = Hanning 0.50
3 = Gaussian 0.75
4 = Kaiser 7.865
5 = 8510 6.0 (This is equivalent to the time-to-frequency transformation with normal gate shape setting in the 8510 series network analyzer.)
6 = Blackman
7 = Blackman-Harris
8 = 8510-Minimum 0
9 = 8510-Maximum 13
‡ † windowConst is not used if windowType is 8510
‡ ‡ If tstart or tstop lies between two time points in the data, then the values are interpolated for these values.
‡ ‡ † If the tranorder variable is not present, or if the user wishes to override the interpolation scheme, then interpOrder may be set to a nonzero value:
1 = use only linear interpolation
2 = use quadratic interpolation
3 = use cubic polynomial interpolation
‡ ‡ ‡ The time-to-frequency transform can be changed by using transformMethod:
1 = Chirp-z transform
2 = Discrete Fourier integral evaluated at each frequency
3 = Fast Fourier transform

Examples

The following example equations assume that a transient simulation was performed from 0 to 5 ns with 176 timesteps, on a 1-GHz-plus-harmonics signal called vOut:
y = fs(vOut)
returns the spectrum (0, 0.2GHz, ... , 17.6GHz), evaluated from 0 to 5 ns.
y = fs(vOut, 0, 10GHz)
returns the spectrum (0, 0.2GHz, ... , 10.0GHz), evaluated from 0 to 5 ns.
y = fs(vOut, 0, 10GHz, 11)
returns the spectrum (0, 1.0GHz, ... , 10.0GHz), evaluated from 0 to 5 ns.
y = fs(vOut, , , , , , , 3ns, 5ns)
returns the spectrum (0, 0.5GHz, ... , 32.0GHz), evaluated from 3 to 5 ns.
y = fs(vOut, 0, 10GHz, 21, , , , 3ns, 5ns)
returns the spectrum (0, 0.5GHz, ... , 10.0GHz), evaluated from 3 to 5 ns.
y=fs(vOut, 0, 10GHz, 11, , "Blackman")
returns the spectrum (0, 1.0GHz, ... , 10.0GHz), evaluated from 0 to 5 ns after a Blackman window is applied.

Defined in

Built in

See Also

fft(), fspot()

Notes/Equations

The dim argument is not used and should be left empty in the expression. Entering a value will have no impact on the results.

fs(x) returns the frequency spectrum of the vector x by using a chirp-z transform. The values returned are peak, complex values. The data to be transformed is typically from a transient, signal processing, or envelope analysis.

Transient simulation uses a variable timestep and variable order algorithm. The user sets an upper limit on the allowed timestep, but the simulator will control the timestep so that the local truncation error of the integration is also controlled. The non-uniformly sampled data are uniformly resampled for fs.

If the Gear integration algorithm is used, the order can also change during simulation. fs can use this information when resampling the data. This variable order integration depends on the presence of a special dependent variable, tranorder, which is output by the transient simulator. When the order varies, the Fourier integration will adjust the order of the polynomial it uses to interpolate the data between timepoints.

Only polynomials of degree one to three are supported. The polynomial is fit from the timepoint in question backwards over the last n points. This is because time-domain data are obtained by integrating forward from zero; previous data are used to determine future data, but future data can never be used to modify past data.

The data are uniformly resampled, with the number of points being determined by increasing the original number of points to the next highest power of two.

The data to be transformed default to all of the data. The user may specify tstart and tstop
to transform a subset of the data.

The starting frequency defaults to 0 and the stopping frequency defaults to 1/(2*newdeltat), where newdeltat is the new uniform timestep of the resampled data. The number of frequencies defaults to (fstop-fstart)*(tstop-tstart)+1. The user may change these by using fstart, fstop, and numfreqs. Note that numfreqs specifies the number of frequencies, not the number of increments. Thus, to get frequencies at (0, 1, 2, 3, 4, 5), numfreqs should be set to 6, not 5.

When the data to be operated on is of the baseband type, such as VO[0] from a Circuit Envelope analysis, where VO is an output node voltage and [0] is index for DC, then in order to obtain a single sided spectrum, only the real part of VO[0] should be used as the argument. i.e., x=fs(real(VO[0],...). This is necessary because the fs() function has no way of knowing the data VO[0] is baseband. Even though VO[0] contains an imaginary part of all zeroes, it is still represented by a complex data type. When the first argument of fs() is complex, the result will be a double-sided spectrum by default.

An alternative method of obtaining a single-sided spectrum from the above baseband data is to specify the frequencies ranges in the spectrum, using the fstart, fstop, and numfreqs parameters of the fs() function.

For example, y=fs(VO[0], 0, 25e3, 251). This will yield a spectrum from 0 to 25 kHz with 26 frequencies and 1 kHz spacing.

This does not apply to data from Transient analysis or Ptolemy simulation because voltage data from Transient and baseband data from Ptolemy are real.

For Envelope analysis, the transform is centered around the fundamental tone. For Signal Processing analysis, it is centered around the characterization frequency.

Differences Between the fs() and fft() Functions

For a periodic signal from t=0 to t=per, fs() requires the full data [0,per], where [] means 0 <= t <= per. The fft is defined as needing data [0,per), meaning 0 <= t < per. The last point at per should be the same as value at zero. fs() requires this point, fft() does not. That is why fs() really requires 2 n+1 points and fft() requires 2 n . So for using the FFT option in the fs() function, there should be 2 n+1 points. However, for the default Chirp Z-transform option, any number of points will work.
Conditions under which fs() may not work properly:

  1. When deltaF equals 0. Where deltaF = (Fstop - Fstart)/(numFreqs).
  2. When 1.0/deltaF > Tstop - Tstart. In this case there are not enough time data for requested frequency resolution.
  3. When 2*numFreqs > numDataPts. In this case there are not enough data points for frequencies.
 

Privacy Statement  | Terms of Use  | Legal | Contact Us  | © Agilent 2000-2008 

Contents
Additional Resources