plotting an array in frequency domain

1 次查看(过去 30 天)
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.

采纳的回答

dpb
dpb 2022-10-23
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by