MCPcopy
hub / github.com/matplotlib/matplotlib / magnitude_spectrum

Method magnitude_spectrum

lib/matplotlib/axes/_axes.py:8221–8303  ·  view source on GitHub ↗

Plot the magnitude spectrum. Compute the magnitude spectrum of *x*. Data is padded to a length of *pad_to* and the windowing function *window* is applied to the signal. Parameters ---------- x : 1-D array or sequence Array or se

(self, x, Fs=None, Fc=None, window=None,
                           pad_to=None, sides=None, scale=None,
                           **kwargs)

Source from the content-addressed store, hash-verified

8219 @_preprocess_data(replace_names=["x"])
8220 @_docstring.interpd
8221 def magnitude_spectrum(self, x, Fs=None, Fc=None, window=None,
8222 pad_to=None, sides=None, scale=None,
8223 **kwargs):
8224 """
8225 Plot the magnitude spectrum.
8226
8227 Compute the magnitude spectrum of *x*. Data is padded to a
8228 length of *pad_to* and the windowing function *window* is applied to
8229 the signal.
8230
8231 Parameters
8232 ----------
8233 x : 1-D array or sequence
8234 Array or sequence containing the data.
8235
8236 %(Spectral)s
8237
8238 %(Single_Spectrum)s
8239
8240 scale : {'default', 'linear', 'dB'}
8241 The scaling of the values in the *spec*. 'linear' is no scaling.
8242 'dB' returns the values in dB scale, i.e., the dB amplitude
8243 (20 * log10). 'default' is 'linear'.
8244
8245 Fc : int, default: 0
8246 The center frequency of *x*, which offsets the x extents of the
8247 plot to reflect the frequency range used when a signal is acquired
8248 and then filtered and downsampled to baseband.
8249
8250 Returns
8251 -------
8252 spectrum : 1-D array
8253 The values for the magnitude spectrum before scaling (real valued).
8254
8255 freqs : 1-D array
8256 The frequencies corresponding to the elements in *spectrum*.
8257
8258 line : `~matplotlib.lines.Line2D`
8259 The line created by this function.
8260
8261 Other Parameters
8262 ----------------
8263 data : indexable object, optional
8264 DATA_PARAMETER_PLACEHOLDER
8265
8266 **kwargs
8267 Keyword arguments control the `.Line2D` properties:
8268
8269 %(Line2D:kwdoc)s
8270
8271 See Also
8272 --------
8273 psd
8274 Plots the power spectral density.
8275 angle_spectrum
8276 Plots the angles of the corresponding frequencies.
8277 phase_spectrum
8278 Plots the phase (unwrapped angle) of the corresponding frequencies.

Callers 3

magnitude_spectrumFunction · 0.80
test_spectrumFunction · 0.80
spectrum_demo.pyFile · 0.80

Calls 3

plotMethod · 0.95
set_xlabelMethod · 0.80
set_ylabelMethod · 0.80

Tested by 1

test_spectrumFunction · 0.64