フィルターのクリア

plotting an array in frequency domain

1 回表示 (過去 30 日間)
U Chon Cheang
U Chon Cheang 2022 年 10 月 23 日
回答済み: dpb 2022 年 10 月 23 日
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 Center および File ExchangeSpectral Measurements についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by