This is my matlab code to get an input via mic and another one that will be a pre-recorded one ,i have used fft in order to plot the graphs in freq domain.Please could anyone suggest me the way or any algorithm to be used to compare these 2 plots ?
Afficher commentaires plus anciens
%Necessary Variable initialisation and Functions function[norm_voice,h] = Voice_Rec(sample_freq); option = 'n'; option='a'; record_len = 1; %Record time length in seconds sample_freq = 8192; %Sampling frequency in Hertz sample_time=sample_freq * record_len;
%Get ready to record your voice To Give The Command option_rec = input('Press y to give the command: ','s'); if option_rec=='y' input('Press enter when ready to record--> '); record = wavrecord(sample_time, sample_freq); %Records the input through the sound card to the variable with specified sampling frequency end
%using Fast fourier Transformation the Run Time Command of frequency domain %Spectrum is Generated [H,W]=freqz(record,1,1000,sample_freq); subplot(211) plot(W,abs(H)),title('Frequency Spectrum of the recorded command'),xlabel('Frequency (Hz)'),ylabel('Ampltide') xlim([100 500])
%Taking FFT x=fft(record)
%The Saved Wav File Frequency Domain Spectrum file = 'DESKTOP/balaji start.wav'; a= wavread(file);
%FFT For Saved Wav File in Frequency Domain spectrum [H,W]=freqz(a,1,2048,sample_freq); subplot(212) plot(W,abs(H)),title('Frequency Spectrum of balaji start'),xlabel('Frequency (Hz)'),ylabel('Ampltide') xlim([100 500])
%Takin FFT y=fft(a)
2 commentaires
José-Luis
le 12 Oct 2012
Please edit your post.
Walter Roberson
le 12 Oct 2012
Are you sure that matlab coder is an appropriate tag here? MATLAB Coder is a product for converting MATLAB code to C code.
Réponses (1)
Wayne King
le 12 Oct 2012
0 votes
If you want to compare two signals in the frequency domain, look at the help for mscohere.m
You can see an example here:
Catégories
En savoir plus sur Signal Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!