2017-04-07 1 views
0

10hzのステップで10hzから1000hzの周波数を生成したいと思っていましたが、5秒以内に(すべての周波数が時間フレーム内で等しく分布しているとします)。以下の個々の周波数ジェネレータ機能からこれをどのように達成できますか?特定の時間内の周波数のランプ音声信号を生成する

function [ ] = producefeq(frequency, duration, amplitude, freqsampling) 

if ~exist('freqsampling', 'var'), freqsampling = 44100; end 
if ~exist('amplitude', 'var'), amplitude = 1; end 
if nargin <2, error('Not enough input arguments'); end 

% the frequency argument will be like this for the case above 10:10:1000 

t = 0:(1/freqsampling):duration; 
y = amplitude*sin(2*pi*frequency*t); 
sound(y, freqsampling); 

end 

ありがとうございます!

答えて

0

producefeqに複数回電話をかけ、複数回の実行の間にはpauseを使用します。

totalDuration = 500; 
frequencies = 10:10:1000; 
duration = totalDuration/length(frequencies); 

for i = 1:length(frequencies) 
    producefeq(frequencies(i), duration) 
    pause(duration) 
end 
関連する問題