Question
Hello. I am using this code for dtmf, but I am receiving this error. Please fix it. function FFT() clear all; close all; clc; filename='pin_4.wav';
Hello. I am using this code for dtmf, but I am receiving this error. Please fix it.
function FFT() clear all; close all; clc; filename='pin_4.wav';
[data, freq]=audioread('pin_4.wav');
sample = 0.05; t = linspace(0,sample,sample*freq); width = length(t); height = length(data)/width; dataS = reshape(data(1:height*width),width,height);
ncol = size(dataS,2); fr = [697 770 852 941 1209 1336 1477 1633]; KEYS=[];
for i=1:4:ncol y = [dataS(:, i)',dataS(:, i+1)']; n = length(y); freq_indices = round(fr/freq*n) + 1; dft_data = goertzel(y,freq_indices); t=abs(dft_data); stem(fr,t); [val,ind] = sort(t,'descend'); an=fr(ind(1:2)); [val,ind] = sort(an,'descend'); KEYS=[KEYS,detect(val)]; end disp(KEYS); end
function c=detect(val) hifreq=val(1); lofreq=val(2);
if lofreq==697 if hifreq==1209 c='1'; end if hifreq==1336 c='2'; end if hifreq==1477 c='3'; end if hifreq==1633 c='A'; end end
if lofreq==770 if hifreq==1209 c='4'; end if hifreq==1336 c='5'; end if hifreq==1477 c='6'; end if hifreq==1633 c='B'; end end if lofreq==852 if hifreq==1209 c='7'; end if hifreq==1336 c='8'; end if hifreq==1477 c='9'; end if hifreq==1633 c='C'; end end
if lofreq==941 if hifreq==1209 c='*'; end if hifreq==1336 c='0'; end if hifreq==1477 c='#'; end if hifreq==1633 c='D'; end end
end
The error:
Output argument "c" (and maybe others) not assigned during call to "FFT>detect".
Error in FFT (line 29) KEYS=[KEYS,detect(val)];
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