I am trying to generate via matlab the DTMF tone using a default function, for the button 5 let say, with no luck at all. The code is:
button5= sin(0.5906*n)+sin(1.0247*n); This line of code is obligated.
n=linspace (-1, 1, 1000);
Fs = 8192;
button5 = sin(0.5906*n)+sin(1.0247*n);
sound(button5, Fs);
Could you please advise regarding?
To explain better:
Trying some combinations of the numbers, I realized Ω is the precomputed 2*pi*f/FS
where f is the frequency.
Here is a version just rewriting the answer from dubafek substituting some variables:
f=[770 1336];
Fs = 8192;
n = [0:10000];
omega=2.*pi.*f./Fs;
button5 = sin(omega(1)*n)+sin(omega(2)*n);
button5=button5/max(button5(:));
sound(button5, Fs);
Which, replacing omega with constants leads to:
Fs = 8192;
n = [0:10000];
button5 = sin(0.5906*n)+sin(1.0247*n);
button5=button5/max(button5(:));
sound(button5, Fs);
The minor differences in the result are because the constant omega in the second case is rounded to four digits. Now having the solution I realize it was only a simple information missing in your question, n
is a vector containing the natural numbers.