Filter löschen
Filter löschen

plotting an array in frequency domain

1 Ansicht (letzte 30 Tage)
U Chon Cheang
U Chon Cheang am 23 Okt. 2022
Beantwortet: dpb am 23 Okt. 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.

Akzeptierte Antwort

dpb
dpb am 23 Okt. 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.

Weitere Antworten (0)

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by