Dual Tone Multi Frequency Fourier Transform

I'm trying to take Fourier Tranfrom of each tones but they are the same graph what am I missing ?
clc
clear all
close
Fs = 8000;
N = 800;
fm = -Fs/2:Fs/N:Fs/2-1;
t = (0:N-1)/Fs;
symbols = {'1','2','3','A','4','5','6','B','7','8','9','C','*','0','#','D'};
rFreqs = [697, 770, 852, 941];
cFreqs = [1209, 1336, 1477, 1633];
f = [];
for i = 1:4
for j = 1:4
f = [ f [rFreqs(i);cFreqs(j)]];
end
end
for toneChoice = 1:16
tones(:,toneChoice) = sum(sin(f(:,toneChoice)*2*pi*t));
figure(1)
subplot(4,4,toneChoice)
plot(t*1e3,tones(:,toneChoice)); xlim([0,25])
title(symbols{toneChoice});xlabel("Time(ms)");ylabel("Amplitude"),
figure(2)
Y = abs(fft(squeeze(tones(:,toneChoice))));
subplot(4,4,toneChoice)
plot(Y)
xlabel("Frequency(Hz)");ylabel("Amplitude");legend(symbols)
end

 Respuesta aceptada

The Fourier transform plots are correct. I changed them to plot a one-sided transform, and this emphasizes the differences in the plotted tones. (I added an approximate frequency vector and a findpeaks call to emphgasize that the plots are correct. Eliminate them if you do not want them.)
% clc
% clear all
% close
format shortG
Fs = 8000;
Fn = Fs/2;
N = 800;
fm = -Fs/2:Fs/N:Fs/2-1;
t = (0:N-1)/Fs;
symbols = {'1','2','3','A','4','5','6','B','7','8','9','C','*','0','#','D'};
rFreqs = [697, 770, 852, 941];
cFreqs = [1209, 1336, 1477, 1633];
f = [];
for i = 1:4
for j = 1:4
f = [ f [rFreqs(i);cFreqs(j)]];
end
end
Fv = linspace(0,1-1/149,N/2)*Fn; % Frequency Vector
for toneChoice = 1:16
tones(:,toneChoice) = sum(sin(f(:,toneChoice)*2*pi*t));
figure(1)
subplot(4,4,toneChoice)
plot(t*1e3,tones(:,toneChoice)); xlim([0,25])
title(symbols{toneChoice});xlabel("Time(ms)");ylabel("Amplitude"),
figure(2)
Y = abs(fft(squeeze(tones(:,toneChoice))));
subplot(4,4,toneChoice)
plot(Fv,Y(1:N/2))
grid
xlabel("Frequency(Hz)");ylabel("Amplitude");legend(symbols(toneChoice))
[pks,locs] = findpeaks(Y(1:N/2)); % Optional
PeakFreqs = Fv(locs) % Optional
end
PeakFreqs = 1×2
1.0e+00 * 697.04 1204.9
PeakFreqs = 1×2
1.0e+00 * 697.04 1334.3
PeakFreqs = 1×2
1.0e+00 * 697.04 1473.8
PeakFreqs = 1×2
1.0e+00 * 697.04 1623.1
PeakFreqs = 1×2
1.0e+00 * 766.75 1204.9
PeakFreqs = 1×2
1.0e+00 * 766.75 1334.3
PeakFreqs = 1×2
1.0e+00 * 766.75 1473.8
PeakFreqs = 1×2
1.0e+00 * 766.75 1623.1
PeakFreqs = 1×2
1.0e+00 * 846.41 1204.9
PeakFreqs = 1×2
1.0e+00 * 846.41 1334.3
PeakFreqs = 1×2
1.0e+00 * 846.41 1473.8
PeakFreqs = 1×2
1.0e+00 * 846.41 1623.1
PeakFreqs = 1×2
1.0e+00 * 936.03 1204.9
PeakFreqs = 1×2
1.0e+00 * 936.03 1334.3
PeakFreqs = 1×2
1.0e+00 * 936.03 1473.8
PeakFreqs = 1×2
1.0e+00 * 936.03 1623.1
.

Más respuestas (0)

Productos

Versión

R2021b

Preguntada:

el 28 de Dic. de 2022

Respondida:

el 28 de Dic. de 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by