why should we multiply the number of samples with sound frequency to calculate the sine wave?

9 ビュー (過去 30 日間)
I have a code that aims to produce sine waves for durations of interest. in line related to creating sine wave, it's written:
tone_dur = sin(2*pi*freqs*t);
t is the number of samples needed for each tone duration and freq is the tone frequence (500 Hz). What I don't get is that why should we multiply the number of samples with sound frequency to calculate the sine wave? I don't get the rational!

採用された回答

Geoff Hayes
Geoff Hayes 2020 年 7 月 6 日
joly - I think that t is usually a time array (in seconds). From fft examples, t can be initialized as
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1500; % Length of signal
t = (0:L-1)*T; % Time vector
Then you should be able to continue as before.
If t were just the number of samples, i.e. a scalar, then tone_dur would be a scalar value as well....and I don't think that is exactly what you want.
  5 件のコメント
Geoff Hayes
Geoff Hayes 2020 年 7 月 6 日
If interval is a time i.e. 0.230 seconds, then t, which is an array from 0 to interval(k), would be an array describing time.
joly Alipor
joly Alipor 2020 年 7 月 6 日
That's exactly right. Thanks a lot for your great help.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio Processing Algorithm Design についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by