MATLAB Answers

use sound for a function

10 ビュー (過去 30 日間)
konoha
konoha 2016 年 5 月 22 日
編集済み: Todd Leonhardt 2016 年 5 月 22 日
I have a function f(t) = sin(t) + sin(3t/2) + sin(5t/4) and I am trying to use sound for f.
Fs=8000;
Ts=1/Fs;
t=[0:Ts:0.3];
sound(sin(t) + sin(3*t/2) + sin(5*t/4))
I keep getting error said not audio output, can someone show me how to make f sound? Thanks,

回答 (1 件)

Todd Leonhardt
Todd Leonhardt 2016 年 5 月 22 日
編集済み: Todd Leonhardt 2016 年 5 月 22 日
The basic equation for a sine wave is:
y = A * sin(2*pi*f*t)
Here f is the frequency in Hz.
Humans can hear from roughly 20 Hz to around 20 kHz, but with the high-end hearing getting worse as you get older. On computers with sub-par audio gear the lower end will be limited to more like 100 Hz.
You are trying to generate audio with frequencies less than 20 Hz.
Try the following:
sound(sin(2*pi*500*t), Fs)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by