freqspace
Frequency grid for frequency responses, normalized so that 1 is the Nyquist frequency.
Category: Language Fundamentals > Matrices and Arrays
Syntax
f = freqspace(n)
Frequencies for an n-point response, from 0 up to just below 1.
f = freqspace(n, 'whole')
Covers the whole circle, 0 up to just below 2.
[f1, f2] = freqspace(n)
Frequency vectors for a 2-D response, each from about -1 to 1.
Description
In one dimension the spacing is 2/n, starting at 0, so freqspace(4) gives 0 0.5 1 and freqspace(5) gives 0 0.4 0.8. Multiply by pi to get radians per sample, or by half the sampling rate to get hertz.
The 2-D form returns the spacing used to evaluate filters and windows on a grid; feed f1 and f2 to meshgrid to cover the plane.
Input arguments
n- Number of frequency points (a scalar), or
[m n]for a 2-D grid. 'whole'- Return the full circle instead of the half up to Nyquist.
Output arguments
f- Row vector of frequencies in units of pi radians per sample.
f1, f2- For the 2-D form, vectors along each frequency axis.
Example
freqspace(4)
freqspace(4, 'whole')
[f1, f2] = freqspace(3);
f1
Output
ans = 1×3
0 0.5000 1.0000
ans = 1×4
0 0.5000 1.0000 1.5000
f1 = 1×3
-0.6667 0 0.6667