필터 지우기
필터 지우기

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 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