Stuck with DTMF code
显示 更早的评论
I want to write a DTMF function which takes 5 inputs and give sound for it with gap of 1 seconds. I know how to concatinetane at the end and other stuff but i am stuck how to take data from fucntion input and tell it to assign a desired frequency. Plz Help me
function dtmf=dtmfdial([a b c d e],fs);
%This function produces DTMF Tone corresponding to given
%key number
%abcdefg=input key numbers
%fs= The sampling frequency
fs=8000
lfg = [697 770 852 941]; % Low frequency group
hfg = [1209 1336 1477]; % High frequency group
f = [];
for c=1:4,
for r=1:3,
f = [ f [lfg(c);hfg(r)] ];
end
end
table=f';
dur=.5;
tt=0:(1/fs):dur;
%******************************************************************
%%Here i want to tell MAtlab that if key number 1 is pressed then the
%frequencies will be table (1,1) and table (1,2) and so on
% how to tell matlab about this
%******************************************************************
tone1=sin(2*pi*table(1,1)*tt);
tone2=sin(2*pi*table(1,2)*tt);
tone_a=tone1+tone2
sil_dur=1;
sil_freq=0;
sil_tt=0:(1/fs):dur;
sil_tone=sin(2*pi*sil_freq*sil_tt)
tone1=sin(2*pi*table(3,1)*tt);
tone2=sin(2*pi*table(3,2)*tt);
tone_b=tone1+tone2
soundsc(tone_a,fs);
soundsc(sil_tone,fs);
soundsc(tone_b,fs);
采纳的回答
更多回答(4 个)
Walter Roberson
2011-10-6
Your line
function dtmf=dtmfdial([a b c d e],fs);
is illegal syntax. It is not allowed to list an array or cell array as a parameter on the right-hand side of a "function" statement.
moonman
2011-10-6
0 个投票
1 个评论
Walter Roberson
2011-10-6
I had a mandatory all-staff meeting at work this morning, which made my sleep and breakfast schedule rather unbalanced. And now I need to go see if some lunch will wake me up.
类别
在 帮助中心 和 File Exchange 中查找有关 DTMF 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!