Question
In MATLAB: The DTMF (Dual Tone Multiple Frequencies) tones are used in signaling over telephone lines. Use the script dtmfDemoTemplate.m: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Ask user
In MATLAB:
The DTMF (Dual Tone Multiple Frequencies) tones are used in signaling over telephone lines. Use the script dtmfDemoTemplate.m:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Ask user to press a key, then play the sum of DTMF tones % corresponding to that key. Also plots the resulting signal. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Fs = 8192; % sampling frequency (Hz) tVec = 0:1/ Fs :1/2; % sample times , from 0 to 0.5 seconds
while 1 keypressed = input('press any digit or * or #: ' ,'s'); % Set the two frequencies (in Hz) if keypressed == '1'
F1 = 697; F2 = 1209; elseif keypressed == '2' F1 = 697; F2 = 1336;
%%% INSERT YOUR CODE HERE. DON"T FORGET '*' and '#' else
fprintf(' Key not recognized; quitting. ');
break; end
% Construct signal as sum of two cosines, one with % frequency F1, and one with frequency F2. Each should % be sampled at times in tVec. Hint: for example, a % "middle A" pure tone would be cos(2*pi*440*tVec).
signal = %%% INSERT YOUR CODE HERE
% Play the sound
sound(signal ,Fs);
% Plot the signal
fprintf([' F1 = ' num2str(F1) 'Hz, F2 = ' ... num2str(F2) 'Hz ']);
figure(1);clf; plot(tVec,signal); xlabel('time (seconds)'); title(['Pressed ' keypressed ': F1 = ' ...
num2str(F1) 'Hz, F2 = ' num2str(F2) 'Hz']);
Insert code in the locations marked "INSERT YOUR CODE HERE". The script should ask user to press a key, then play the correct sum of DTMF tones corresponding to the key pressed, and also produce a plot of the signal.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started