Sampling frequency in Matlab
10 次查看(过去 30 天)
显示 更早的评论
clc;close all;clear all;
%%
[signal,Fs]=audioread('Dn-10.mp3');%Signal input
in mp3 format.
sound(signal,Fs);%Fs(sampling frequency)=44100Hz.
p=length(signal);
c=fft(signal,p);%Fourier transform.
y_n=abs(c);%Magnitude of the FFT.
Phase_c=unwrap(angle(c)); %Phase of the FFT.
x_n=((0:1/p:1-(1/p))*Fs);
w=phase(1:p/2); %Half range of phase of length of signal.
g_magnitude=abs(1:p/2); %Magnitude Spectrum of the signal.
figure(1)
plot(x_n,y_n);
xlabel('Given audio signal frequency in Hz');
ylabel('Given audio signal amplitude');
title('For the given audio signal of frequency response');
xlim([0,1100]); %Bounded the signal 0 to 1100Hz in X-axis.
p=max(y_n);%Find the max value of y_n signal.
q=(y_n==p(1));
r=find(q);
Frequency=x_n(r(1))%Finding corresponding frequency value.
if(Frequency>=100 && Frequency<=325)%The observed characteristic frequency
change for the signal.
disp('The given signal command is Wait.')
else
disp('The given signal command is Go.')
end
Here is simple matlab code to match a voice signal with its input voice signal. Can anyone explain how this code is working?
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!