SSブログ

AF Two Tone Generator を Scilab で作る [Simulation]

 SDR を simulation するのに Scilab の勉強を始めました。 まず、AF Two Tone Generator を Scilab で作ってみました。 (グラフを subplot() 関数を使って、3つに分けました)

〔出来た波形〕
AF two tone subplot.jpg
上から順に 700Hz、1700Hz、Two Tone 信号です。

このデータを wav ファイルに保存するか、PCから音データとして再生すれば、PCを使った AF Two Tone Generator の完成です。
〔プログラム〕
// AF signal
// 700Hz + 1700Hz
// Sampling frequency
// 128kHz
// simulation time
// T sec

afreq1 = 700;
afreq2 = 1700;
sf = 128000;
a1 = 0.1;
a2 = 0.1;

T = 1/sf; // calculate sampling period

while(1)
printf('\n');
st = input('input simulation time [Sec] ?? (E is exit)');
if st == ['E'] then break end;
// calculate the number of sampling points
sp = st * sf;
k = 1:sp;

// Two Tone AF signal
af1 = a1*sin(2*%pi*afreq1*k*T);
af2 = a2*sin(2*%pi*afreq2*k*T);
af = af1 + af2;
subplot(3,1,1);
plot(af1, 'r');
subplot(3,1,2);
plot(af2, 'g');
subplot(3,1,3);
plot(af, 'b'); // playsnd(af);
end

nice!(0)  コメント(0)  トラックバック(0) 
共通テーマ:趣味・カルチャー

nice! 0

コメント 0

コメントを書く

お名前:[必須]
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

トラックバック 0