Generate Alternating Tones Based On Number Of Cycles
1 回表示 (過去 30 日間)
古いコメントを表示
Hi, I need to generate a sine wave that alternates between 5 cycles of 651hz, and 4 cycles of 465hz, 100 times.
My current code works, but the frequency gets rounded to a frequency divisible by 48000.
Can I get any help?
3 件のコメント
回答 (1 件)
Davide Masiello
2022 年 11 月 2 日
編集済み: Davide Masiello
2022 年 11 月 2 日
I am still quite unsure if this is what you are asking, but I will give it a go.
[t,w] = wave(465);
plot(t,w)
function [t,f] = wave(freq)
t = linspace(0,1/freq,48000);
f(1:48000/2) = 1;
f(48000/2+1:48000) = -1;
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Audio I/O and Waveform Generation についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!