Borrar filtros
Borrar filtros

plotting an array in frequency domain

1 visualización (últimos 30 días)
U Chon Cheang
U Chon Cheang el 23 de Oct. de 2022
Respondida: dpb el 23 de Oct. de 2022
I just wonder how do I plot an array in frequency domain?
For exmaple, I am now having two arrays
t = (1:6)/Fs
r = [7 8 9 10 11 12]
For t do I just plot from 0 to Fs? How should I turn the array r into dB? Can I apply turn the whole arrary into dB?
Thank you.

Respuesta aceptada

dpb
dpb el 23 de Oct. de 2022
L=numel(t); % how long is t vector???
f = Fs*(0:L-1); % zero-based frequency of same number elements
NOTA BENE:: The "-1" correction for 0-based counting instead of 1-based to match total number of elements.
It is peculiar to base the frequency vector on the length of the time vector, however; generally one uses a fft to convert a time-based sampled data set into frequency and the zero-based one-sided frequency vector is then half the length of the input time trace. See the examples at the doc link above for typical application/use.
db in Signal Processing Toolbox will convert to decibels assuming voltage or optional based on power (square input).
As virtually all MATLAB functions are, it is vectorized to operate over an input vector or array.

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by