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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!