Finding frequency and duration of an audio signal

9 ビュー (過去 30 日間)
Ban Coder
Ban Coder 2019 年 10 月 12 日
コメント済み: Star Strider 2019 年 10 月 15 日
What is the frequency (not the sampling rate) and duration of this audio?
>> fs=24000.0; % Sampling rate
>> t=0:1/fs:1; % One sample each Ts=1/fs
>> x=cos(2pi1000t);
>> sound(x,fs);
I'm trying to learn signal processing ... and I can't find the answer to this question anywhere.
Thanks in advance.

採用された回答

Star Strider
Star Strider 2019 年 10 月 12 日
編集済み: Star Strider 2019 年 10 月 12 日
You specified it to be 1 kHz, and 1 second duration, so it is just that:
fs=24000.0; % Sampling rate
t=0:1/fs:1; % One sample each Ts=1/fs
x=cos(2*pi*1000*t);
sound(x,fs);
L = numel(t);
fn = fs/2;
FTx = fft(x)/L;
Fv = linspace(0, 1, fix(L/2)+1)*fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTx(Iv))*2)
grid
xlim([0 2000])
The Fourier transform plot demonstrates it.
  2 件のコメント
Ban Coder
Ban Coder 2019 年 10 月 15 日
Thank you so much!
Star Strider
Star Strider 2019 年 10 月 15 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSignal Processing Toolbox についてさらに検索

製品


リリース

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by