SlideShare a Scribd company logo
Contents
 Matlab Code:
 signal into left and right, stereo records
 time for right signal only (stereo) for original signals
 find new length
 find new time
 find new frequency
 perform fft and plot of the cut orignal signal
 Zoom in to signal baseline noise signal
 plot two signals
 plot fft compare
 calculate and compare two signals
 corlation
Matlab Code:
Author: Minh Anh Nguyen (minhanhnguyen@q.com) This script will perform the following
tasks:
%1. read in two "wav" files, plot the signals of these files
%2. fft
% 3. compare input signals, and display a message on the screen whether or
not the signals are the same.
% the MSE must be 0, for both signals are the same.
% The script will read in a stereo data (right channel)
close all;% Close all figures (except those of imtool.)
clear all; % Erase all existing variables.
clc;% Clear the command window.
fontSize = 20;
fontSize1 = 14;
fontSize2 = 12;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Please edit files
% set folder
folder = 'C:UsersMinh anhDesktopmicrophone-project-demo';
%%Open WAV file:
sound1=audioread('.good 2.wav');
[y1,fs1]=audioread('.good 2.wav');
sound2=audioread('.good 3.wav');
[y2,fs2]=audioread('.good 3.wav');
% sound2=audioread('.upper_channel 2.wav');
% [y2,fs2]=audioread('.upper_channel 2.wav');
% sound2=audioread('.upper_channel_bide 1.wav');
% [y2,fs2]=audioread('.upper_channel_bide 1.wav');
% sound2=audioread('.lower_channel 1.wav');
% [y2,fs2]=audioread('.lower_channel 1.wav');
% sound2=audioread('.pin1.wav');
% [y2,fs2]=audioread('.pin1.wav');
sound1_baseline_noise=audioread('.good 2_noise.wav');
[y1_basenoise,fs1_basenoise]=audioread('.good 2_noise.wav');
%
sound2_baseline_noise=audioread('.good 3_noise.wav');
[y2_basenoise,fs2_basenoise]=audioread('.good 3_noise.wav');
% sound2_baseline_noise=audioread('upper_channel 2_noise.wav');
% [y2_basenoise,fs2_basenoise]=audioread('.upper_channel 2_noise.wav');
% sound2_baseline_noise=audioread('upper_channel_bide 1_noise.wav');
% [y2_basenoise,fs2_basenoise]=audioread('.upper_channel_bide 1_noise.wav');
% sound2_baseline_noise=audioread('lower_channel 1_noise.wav');
% [y2_basenoise,fs2_basenoise]=audioread('.lower_channel 1_noise.wav');
% sound2_baseline_noise=audioread('.pin1_noise.wav');
% [y2_basenoise,fs2_basenoise]=audioread('.pin1_noise.wav');
signal into left and right, stereo records
size(y1);
left1=y1(:,1);
right1=y1(:,2);
[MR1,NR1] = size(right1);
size(y2);
left2=y2(:,1);
right2=y2(:,2);
[MR2,NR2] = size(right2);
time for right signal only (stereo) for original signals
Nl = length(right1); % number of points to analyze
lsl = size (right1); % find the length of the data per second
nbits = 2^(length(right1));
t1l = (0:1:length(right1)-1)/fs1;
fx = fs1*(0:Nl/2-1)/Nl; %Prepare freq data for plot
T1 = 1/fs1; % period between each sample
N = Nl;
N2 = length(right2);
ls2 = size (right2); % find the length of the data per second
nbits2 = 2^(length(right2));
t2 = (0:1:length(right2)-1)/fs2;
fx2 = fs2*(0:N2/2-1)/N2; %Prepare freq data for plot
T2 = 1/fs2; % period between each sample
% baseline noise is removed from signals
size(y1_basenoise);
left1_basenoise=y1_basenoise(:,1);
right1_basenoise=y1_basenoise(:,2);
[MR1_basenoise,NR1_basenoise] = size(right1_basenoise);
size(y2_basenoise);
left2_basenoise=y2_basenoise(:,1);
right2_basenoise=y2_basenoise(:,2);
[MR2_basenoise,NR2_basenoise] = size(right2_basenoise);
t1_basenoise = (0:1:length(right1_basenoise)-1)/fs1_basenoise;
t2_basenoise = (0:1:length(right2_basenoise)-1)/fs2_basenoise;
%%cut signal to the same length for comparing
voice1 = right1(fs1*1 : fs1*40);
voice2 = right2(fs2*1 : fs2*40);
find new length
N2x = length(voice2);
N1x = length(voice1);
find new time
t1x = (0:1:length(voice1)-1)/fs1;
t2x = (0:1:length(voice2)-1)/fs2;
find new frequency
f2x = fs2*(0:N2x/2-1)/N2x;
f1x = fs1*(0:N1x/2-1)/N1x;
perform fft and plot of the cut orignal signal
NFFT1x = 2 ^ nextpow2(N1x);
Y1x = fft(voice1, NFFT1x)/ N1x;
f1xx = (fs1/ 2 * linspace(0, 1, NFFT1x / 2+1))'; % Vector containing
frequencies in Hz
STFFT1x = ( 2 * abs(Y1x(1: NFFT1x / 2+1))); % Vector containing corresponding
amplitudes
NFFT2x = 2 ^ nextpow2(N2x);
Y2x = fft(voice2, NFFT2x) / N2x;
f2xx = (fs2 / 2 * linspace(0, 1, NFFT2x / 2+1))'; % Vector containing
frequencies in Hz
STFFT2x = ( 2 * abs(Y2x(1: NFFT2x / 2+1))); % Vector containing corresponding
amplitudes
% plot of the cut orginal signal
figure; subplot (2,2,1); plot(t1x, voice1);xlim([0,40]); ylim([-2,2]);
%str1=sprintf('Correct loading with sampling rate = %d Hz, number sample =
%d', fs1, N1x);
str1=sprintf('Correct loading signal');
title(str1,'Fontsize', fontSize2);
xlabel('Time (sec)','Fontsize', fontSize1); ylabel('Amplitude','Fontsize',
fontSize1); grid on;
subplot (2,2,2); plot(t2x, voice2); xlim([0,40]); ylim([-2,2]);
%str2=sprintf(' User loading with sampling rate = %d Hz, number sample = %d',
fs2, N2x);
str2=sprintf('User loading signal');
title(str2,'Fontsize', fontSize2); xlabel('Time (sec)','Fontsize',
fontSize1); ylabel('Amplitude','Fontsize', fontSize1); grid on;
% plot of the fft cut signal2
%subplot (2,2,3); plot(f1xx, STFFT1x); xlim([0,1500]); ylim([0,.09]);
figure;
plot(f1xx, STFFT1x); xlim([0,1500]); ylim([0,.09]);
str1ft1=sprintf('Single-sided Power spectrum for Correct loading');
title(str1ft1,'Fontsize', fontSize2);
ylabel ('Magnitude','Fontsize', fontSize1); xlabel ('Frequency
[Hz]','Fontsize', fontSize1); grid on;
% display markers at specific data points on DFT graph
indexmin1 = find(min(STFFT1x) == STFFT1x);
xmin1 = f1xx(indexmin1);
ymin1 = STFFT1x(indexmin1);
indexmax1 = find(max(STFFT1x) == STFFT1x);
xmax1 = f1xx(indexmax1);
ymax1 = STFFT1x(indexmax1);
strmax1 = ['Frequency = ',num2str(xmax1),' Hz',' ','Magnitude=',
num2str(ymax1),''];
text(xmax1,ymax1,strmax1,'HorizontalAlignment','Left');
%subplot (2,2,4); plot(f2xx, STFFT2x); xlim([0,1500]); ylim([0,.09]);
figure; plot(f2xx, STFFT2x); xlim([0,1500]); ylim([0,.09]);
str1ft2=sprintf('Single-sided Power spectrum for User loading');
title(str1ft2,'Fontsize', fontSize2);
ylabel ('Magnitude', 'Fontsize', fontSize1); xlabel ('Frequency
[Hz]','Fontsize', fontSize1); grid on;
% display markers at specific data points on DFT graph
indexmin2 = find(min(STFFT2x) == STFFT2x);
xmin2 = f2xx(indexmin2);
ymin2 = STFFT2x(indexmin2);
indexmax2 = find(max(STFFT2x) == STFFT2x);
xmax2 = f2xx(indexmax2);
ymax2 = STFFT2x(indexmax2);
strmax2 = ['Frequency = ',num2str(xmax2),' Hz',' ','Magnitude =',
num2str(ymax2),' '];
text(xmax2,ymax2,strmax2,'HorizontalAlignment','Left');
Zoom in to signal baseline noise signal
figure; subplot(3,2,1); plot(t1_basenoise,right1_basenoise); xlim([0,10]);
ylim([-2,2]);
str1=sprintf('Correct loading with Zoom in');
title(str1,'Fontsize', fontSize1);
xlabel('Time (secs)','Fontsize', fontSize1); ylabel('Amplitude','Fontsize',
fontSize1); grid on;
subplot(3,2,3); plot(t2_basenoise,right2_basenoise,'r'); xlim([0,10]);
ylim([-2,2]);
str2=sprintf('User loading with Zoom in');
title(str2, 'Fontsize', fontSize1);
xlabel('Time (secs)','Fontsize', fontSize1); ylabel('Amplitude','Fontsize',
fontSize1); grid on;
plot two signals
figure, plot(t1_basenoise,right1_basenoise,
t2_basenoise,right2_basenoise,'r'); xlim([0,10]); ylim([-2,2]);
str2=sprintf('Comparing two loading signals with Zoom in ');
title(str2, 'Fontsize', fontSize1);
xlabel('Time (secs)','Fontsize', fontSize1); ylabel('Amplitude','Fontsize',
fontSize1); grid on;
legend ('Correct loading signal', 'User loading signal', 'Fontsize',
fontSize);
Warning: Using an integer to specify the legend location is not supported.
Specify the legend location with respect to the axes using the 'Location'
parameter.
Warning: Ignoring extra legend entries.
plot fft compare
figure, plot(f1xx, STFFT1x,f2xx, STFFT2x,'r'); xlim([0,1500]); ylim([0,.09]);
str1ft3=sprintf('Comparing FFT for two loading signals');
title(str1ft3,'Fontsize', fontSize1);
ylabel ('Magnitude', 'Fontsize', fontSize1); xlabel ('Frequency
[Hz]','Fontsize', fontSize1); grid on;
indexmax3 = find(max(STFFT2x) == STFFT2x);
xmax3 = f2xx(indexmax3);
ymax3 = STFFT2x(indexmax3);
strmax3 = ['Frequency = ',num2str(xmax3),' Hz',' ','Magnitude= ',
num2str(ymax3),' '];
legend ('Correct loading signal', 'User loading signal','Fontsize',
fontSize);
Warning: Using an integer to specify the legend location is not supported.
Specify the legend location with respect to the axes using the 'Location'
parameter.
Warning: Ignoring extra legend entries.
calculate and compare two signals
Calculate the MSE
D= voice1 - voice2;
MSE=mean(D.^2);
%msgbox(strcat('MSE value is= ',mat2str(),' MSE'));
%msgbox(strcat('MSE value is= ',mat2str(MSE)));
%if MSE ==0;
%if MSE <= 0.00135; %%v this will work
if MSE <= 5.2731e-09 ; %%v this will work
disp('Signal are the same');
else
% msgbox(strcat('MSE value is= ',mat2str(MSE)));
disp('Signal are not the same');
msgbox('Centrifuge loading error. Please check bearings are seated
properly');
end
% %% play back play back the audio files
% disp('Playing (correctly loaded).');
% sound(y1,fs1);
% pause; %create a 2 second pause
%
%
% disp('Playing the user loading.');
% sound(y2,fs2);
% pause
%%Calculate variance, mean and standard deviation of sounds
D1c= STFFT1x - STFFT2x;
MSEfft=mean(D1c.^2);
disp(['MSEfft' num2str(MSEfft)]);
mean1= sum(right1)/N;
mean2= sum(right2)/N2;
stdev1 = sqrt ((sum(right1-mean1).^2)/2);
stdev2 = sqrt ((sum(right2-mean2).^2)/2);
% var(right1(1:length(right2))-right2) %for the whole signal y1-y2
var(voice1(1:length(voice2))-voice2); %for the voice
fprintf('digital statitics of voice 1 a same length signalnn');
fprintf('mean of voice 1:%fn', mean(voice1));
fprintf('standard deviation of voice 1:%fn', std(voice1));
fprintf('variance of voice 1:%fn', std(voice1)^2);
fprintf('average power of voice 1:%fn', mean(voice1.^2));
fprintf('average magnitude of voice 1:%fn', mean(abs(voice1)));
% prod1 = sound1(1:N-1) * sound1(2:N);
% crossing1 = length (find(prod1<0));
% fprintf(' zero crossing of sound 1:% 0.fn', crossing1);
%
fprintf('ndigital statitics of voice 2nn');
fprintf('mean of voice 2:%fn', mean(voice2));
fprintf('standard deviation of voice 2:%fn', std(voice2));
fprintf('variance of voice 2:%fn', std(voice2)^2);
fprintf('average power of voice 2:%fn', mean(voice2.^2));
fprintf('average magnitude of voice 2:%fn', mean(abs(voice2)));
% prod1 = sound1(1:N-1) * sound1(2:N);
% crossing1 = length (find(prod1<0));
% fprintf(' zero crossing of sound 1:% 0.fn', crossing1);
%
% % var(right1(1:length(right2))-right2) %for the whole signal y1-y2
% var(voice1(1:length(voice2))-voice2); %for the voice
%
%
Signal are the same
MSEfft0
digital statitics of voice 1 a same length signal
mean of voice 1:-0.000105
standard deviation of voice 1:0.251742
variance of voice 1:0.063374
average power of voice 1:0.063374
average magnitude of voice 1:0.197595
digital statitics of voice 2
mean of voice 2:-0.000105
standard deviation of voice 2:0.251742
variance of voice 2:0.063374
average power of voice 2:0.063374
average magnitude of voice 2:0.197595
correlation
[C1, lag1] = xcorr(abs((fft(voice1))),abs((fft(voice2)) ));
figure, plot(lag1/fs1,C1);
ylabel('Amplitude'); grid on
title('Cross-correlation between Correct and User loading files')
% %% plot orginal signal. for debug. %% team does not like long length
% %% perform fft and plot of orignal signal
% %
% figure; subplot (2,2,1); plot(t1, sound1);
% title ('Signal of sound 1 , frequency = 44100 Hz and number sample =
2742270');
% xlabel('time (sec)'); ylabel('relative signal strength'); grid on;
% %
% subplot (2,2,2); plot(t2, sound2);
% title ('Signal of sound 2, frequency = 44100 Hz and number sample =
2674665');
% xlabel('time (sec)'); ylabel('relative signal strength'); grid on;
% %% fft of orignal signal
% NFFT1 = 2 ^ nextpow2(N);
% Y1 = fft(y1, NFFT1)/ N;
% f1 = (fs1 / 2 * linspace(0, 1, NFFT1 / 2+1))'; % Vector containing
frequencies in Hz
% STFFT1 = ( 2 * abs(Y1(1: NFFT1 / 2+1))); % Vector containing corresponding
amplitudes
% subplot (2,2,3); plot(f1, STFFT1); title ('Single-sided Power spectrum for
Sound1');
% %subplot (2,2,3); plot(abs(fft(sound1))); title ('plot fft of Sound 1');
%plot Magnitude of fft
% ylabel ('Magnitude |y(f)|'); xlabel ('frequency [Hz]'); grid on;
%
% NFFT2 = 2 ^ nextpow2(N2);
% Y2 = fft(y2, NFFT2) / N2;
% f2 = (fs2 / 2 * linspace(0, 1, NFFT2 / 2+1))'; % Vector containing
frequencies in Hz
% STFFT2 = ( 2 * abs(Y2(1: NFFT2 / 2+1))); % Vector containing corresponding
amplitudes
% subplot (2,2,4); plot(f2, STFFT2); title ('Single-sided Power spectrum for
Sound2');
% % subplot (2,2,4); plot(abs(fft(sound2))); title ('plot fft of Sound2');
% ylabel ('Magnitude |y(f)|'); xlabel ('frequency [Hz]'); grid on;
Published with MATLAB® R2016a

More Related Content

What's hot

Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and Interpolation
Fernando Ojeda
 
Signal Prosessing Lab Mannual
Signal Prosessing Lab Mannual Signal Prosessing Lab Mannual
Signal Prosessing Lab Mannual
Jitendra Jangid
 
Dsp Lab Record
Dsp Lab RecordDsp Lab Record
Dsp Lab Record
Aleena Varghese
 
EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf
EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf
EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf
Loren Schwappach
 
Matlab 2
Matlab 2Matlab 2
Matlab 2asguna
 
DSP_FOEHU - Lec 09 - Fast Fourier Transform
DSP_FOEHU - Lec 09 - Fast Fourier TransformDSP_FOEHU - Lec 09 - Fast Fourier Transform
DSP_FOEHU - Lec 09 - Fast Fourier Transform
Amr E. Mohamed
 
Lti system
Lti systemLti system
Lti system
Fariza Zahari
 
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier TransformDSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
Amr E. Mohamed
 
DSP_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_FOEHU - Lec 08 - The Discrete Fourier TransformDSP_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_FOEHU - Lec 08 - The Discrete Fourier Transform
Amr E. Mohamed
 
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter DesignDSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
Amr E. Mohamed
 
Digital Signal Processing Lab Manual ECE students
Digital Signal Processing Lab Manual ECE studentsDigital Signal Processing Lab Manual ECE students
Digital Signal Processing Lab Manual ECE students
UR11EC098
 
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLABDIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
Martin Wachiye Wafula
 
Dsp U Lec10 DFT And FFT
Dsp U   Lec10  DFT And  FFTDsp U   Lec10  DFT And  FFT
Dsp U Lec10 DFT And FFT
taha25
 
Digital Signal Processing
Digital Signal ProcessingDigital Signal Processing
Digital Signal Processing
Sandip Ladi
 
Dsp U Lec04 Discrete Time Signals & Systems
Dsp U   Lec04 Discrete Time Signals & SystemsDsp U   Lec04 Discrete Time Signals & Systems
Dsp U Lec04 Discrete Time Signals & Systems
taha25
 
signals and system
signals and systemsignals and system
signals and system
Naatchammai Ramanathan
 
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time SignalsDSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
Amr E. Mohamed
 
communication system Chapter 2
communication system Chapter 2communication system Chapter 2
communication system Chapter 2moeen khan afridi
 

What's hot (20)

Decimation and Interpolation
Decimation and InterpolationDecimation and Interpolation
Decimation and Interpolation
 
Signal Prosessing Lab Mannual
Signal Prosessing Lab Mannual Signal Prosessing Lab Mannual
Signal Prosessing Lab Mannual
 
Dsp Lab Record
Dsp Lab RecordDsp Lab Record
Dsp Lab Record
 
Signal & system
Signal & systemSignal & system
Signal & system
 
EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf
EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf
EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf
 
Matlab 2
Matlab 2Matlab 2
Matlab 2
 
DSP_FOEHU - Lec 09 - Fast Fourier Transform
DSP_FOEHU - Lec 09 - Fast Fourier TransformDSP_FOEHU - Lec 09 - Fast Fourier Transform
DSP_FOEHU - Lec 09 - Fast Fourier Transform
 
Lti system
Lti systemLti system
Lti system
 
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier TransformDSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_2018_FOEHU - Lec 08 - The Discrete Fourier Transform
 
DSP_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_FOEHU - Lec 08 - The Discrete Fourier TransformDSP_FOEHU - Lec 08 - The Discrete Fourier Transform
DSP_FOEHU - Lec 08 - The Discrete Fourier Transform
 
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter DesignDSP_2018_FOEHU - Lec 06 - FIR Filter Design
DSP_2018_FOEHU - Lec 06 - FIR Filter Design
 
Digital Signal Processing Lab Manual ECE students
Digital Signal Processing Lab Manual ECE studentsDigital Signal Processing Lab Manual ECE students
Digital Signal Processing Lab Manual ECE students
 
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLABDIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
DIGITAL SIGNAL PROCESSING: Sampling and Reconstruction on MATLAB
 
Dsp U Lec10 DFT And FFT
Dsp U   Lec10  DFT And  FFTDsp U   Lec10  DFT And  FFT
Dsp U Lec10 DFT And FFT
 
Digital Signal Processing
Digital Signal ProcessingDigital Signal Processing
Digital Signal Processing
 
Dsp U Lec04 Discrete Time Signals & Systems
Dsp U   Lec04 Discrete Time Signals & SystemsDsp U   Lec04 Discrete Time Signals & Systems
Dsp U Lec04 Discrete Time Signals & Systems
 
signals and system
signals and systemsignals and system
signals and system
 
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time SignalsDSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
DSP_2018_FOEHU - Lec 02 - Sampling of Continuous Time Signals
 
Lecture9
Lecture9Lecture9
Lecture9
 
communication system Chapter 2
communication system Chapter 2communication system Chapter 2
communication system Chapter 2
 

Viewers also liked

Review of fourier series
Review of fourier seriesReview of fourier series
Review of fourier series
Max Powers
 
Fourier Specturm via MATLAB
Fourier Specturm via MATLABFourier Specturm via MATLAB
Fourier Specturm via MATLABZunAib Ali
 
Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01
Rimple Mahey
 
Kernel Methods on Manifolds
Kernel Methods on ManifoldsKernel Methods on Manifolds
Kernel Methods on Manifolds
Sadeep Jayasumana
 
DSP 05 _ Sheet Five
DSP 05 _ Sheet FiveDSP 05 _ Sheet Five
DSP 05 _ Sheet Five
Amr E. Mohamed
 
SE2_Lec 18_ Coding
SE2_Lec 18_ CodingSE2_Lec 18_ Coding
SE2_Lec 18_ Coding
Amr E. Mohamed
 
Manifold learning
Manifold learningManifold learning
Manifold learning
Wei Yang
 
numerical differentiation&integration
numerical differentiation&integrationnumerical differentiation&integration
numerical differentiation&integration8laddu8
 
How to work on Matlab.......
How to work on Matlab.......How to work on Matlab.......
How to work on Matlab.......biinoida
 
AEM Fourier series
 AEM Fourier series AEM Fourier series
AEM Fourier series
Siddhi Viradiya
 
Fourier series example
Fourier series exampleFourier series example
Fourier series exampleAbi finni
 
Manifold Learning
Manifold LearningManifold Learning
Manifold Learning
Phong Vo
 
fourier series
fourier seriesfourier series
fourier series8laddu8
 
Manifold learning with application to object recognition
Manifold learning with application to object recognitionManifold learning with application to object recognition
Manifold learning with application to object recognitionzukun
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
Murshida ck
 
Dimension Reduction And Visualization Of Large High Dimensional Data Via Inte...
Dimension Reduction And Visualization Of Large High Dimensional Data Via Inte...Dimension Reduction And Visualization Of Large High Dimensional Data Via Inte...
Dimension Reduction And Visualization Of Large High Dimensional Data Via Inte...
wl820609
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & Scientists
Ray Phan
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
Muhammad Rizwan
 
MATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi SharmaMATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi Sharma
Abee Sharma
 
Self-organizing map
Self-organizing mapSelf-organizing map
Self-organizing map
Tarat Diloksawatdikul
 

Viewers also liked (20)

Review of fourier series
Review of fourier seriesReview of fourier series
Review of fourier series
 
Fourier Specturm via MATLAB
Fourier Specturm via MATLABFourier Specturm via MATLAB
Fourier Specturm via MATLAB
 
Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01Solvedproblems 120406031331-phpapp01
Solvedproblems 120406031331-phpapp01
 
Kernel Methods on Manifolds
Kernel Methods on ManifoldsKernel Methods on Manifolds
Kernel Methods on Manifolds
 
DSP 05 _ Sheet Five
DSP 05 _ Sheet FiveDSP 05 _ Sheet Five
DSP 05 _ Sheet Five
 
SE2_Lec 18_ Coding
SE2_Lec 18_ CodingSE2_Lec 18_ Coding
SE2_Lec 18_ Coding
 
Manifold learning
Manifold learningManifold learning
Manifold learning
 
numerical differentiation&integration
numerical differentiation&integrationnumerical differentiation&integration
numerical differentiation&integration
 
How to work on Matlab.......
How to work on Matlab.......How to work on Matlab.......
How to work on Matlab.......
 
AEM Fourier series
 AEM Fourier series AEM Fourier series
AEM Fourier series
 
Fourier series example
Fourier series exampleFourier series example
Fourier series example
 
Manifold Learning
Manifold LearningManifold Learning
Manifold Learning
 
fourier series
fourier seriesfourier series
fourier series
 
Manifold learning with application to object recognition
Manifold learning with application to object recognitionManifold learning with application to object recognition
Manifold learning with application to object recognition
 
An Introduction to MATLAB for beginners
An Introduction to MATLAB for beginnersAn Introduction to MATLAB for beginners
An Introduction to MATLAB for beginners
 
Dimension Reduction And Visualization Of Large High Dimensional Data Via Inte...
Dimension Reduction And Visualization Of Large High Dimensional Data Via Inte...Dimension Reduction And Visualization Of Large High Dimensional Data Via Inte...
Dimension Reduction And Visualization Of Large High Dimensional Data Via Inte...
 
Advanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & ScientistsAdvanced MATLAB Tutorial for Engineers & Scientists
Advanced MATLAB Tutorial for Engineers & Scientists
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
 
MATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi SharmaMATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi Sharma
 
Self-organizing map
Self-organizing mapSelf-organizing map
Self-organizing map
 

Similar to Matlab code for comparing two microphone files

Question I Part (a) 1.SOURCE CODE LISTING for numb.docx
Question I Part (a) 1.SOURCE CODE LISTING for numb.docxQuestion I Part (a) 1.SOURCE CODE LISTING for numb.docx
Question I Part (a) 1.SOURCE CODE LISTING for numb.docx
catheryncouper
 
DSP Lab 1-6.pdf
DSP Lab 1-6.pdfDSP Lab 1-6.pdf
DSP Lab 1-6.pdf
SaiSumanthK1
 
Basic simulation lab manual1
Basic simulation lab manual1Basic simulation lab manual1
Basic simulation lab manual1Janardhana Raju M
 
Dsp manual
Dsp manualDsp manual
Dsp manual
pramod naik
 
Fast Fourier Transform (FFT) of Time Series in Kafka Streams
Fast Fourier Transform (FFT) of Time Series in Kafka StreamsFast Fourier Transform (FFT) of Time Series in Kafka Streams
Fast Fourier Transform (FFT) of Time Series in Kafka Streams
HostedbyConfluent
 
Matlab kod taslağı
Matlab kod taslağıMatlab kod taslağı
Matlab kod taslağıMerve Cvdr
 
Exam 6 commlab 18_119_ei0292
Exam 6 commlab 18_119_ei0292Exam 6 commlab 18_119_ei0292
Exam 6 commlab 18_119_ei0292
lucky859450
 
Digitla Communication pulse shaping filter
Digitla Communication pulse shaping filterDigitla Communication pulse shaping filter
Digitla Communication pulse shaping filtermirfanjum
 
Dsp gcu lab11
Dsp gcu lab11Dsp gcu lab11
Dsp gcu lab11
Jannat41
 
Matlab Señales Discretas
Matlab Señales DiscretasMatlab Señales Discretas
Matlab Señales Discretas
Victor Contreras
 
bask, bfsk, bpsk
bask, bfsk, bpskbask, bfsk, bpsk
bask, bfsk, bpsk
blzz2net
 
Comm lab manual_final
Comm lab manual_finalComm lab manual_final
Comm lab manual_final
GauravMishra427
 
Comm lab manual_final-1
Comm lab manual_final-1Comm lab manual_final-1
Comm lab manual_final-1
Abhishek Bansal
 
matlab.docx
matlab.docxmatlab.docx
Matlab fair-record-model
Matlab fair-record-modelMatlab fair-record-model
Matlab fair-record-modelajaydev1111
 
Implementation of adaptive stft algorithm for lfm signals
Implementation of adaptive stft algorithm for lfm signalsImplementation of adaptive stft algorithm for lfm signals
Implementation of adaptive stft algorithm for lfm signals
eSAT Journals
 
Modulation techniques matlab_code
Modulation techniques matlab_codeModulation techniques matlab_code
Modulation techniques matlab_code
Вахидреза Мохсени
 
signal homework
signal homeworksignal homework
signal homeworksokok22867
 
Filter Implementation And Evaluation Project
Filter Implementation And Evaluation ProjectFilter Implementation And Evaluation Project
Filter Implementation And Evaluation ProjectAssignmentpedia
 
Matlab Homework Help
Matlab Homework HelpMatlab Homework Help
Matlab Homework Help
Matlab Homework Help
 

Similar to Matlab code for comparing two microphone files (20)

Question I Part (a) 1.SOURCE CODE LISTING for numb.docx
Question I Part (a) 1.SOURCE CODE LISTING for numb.docxQuestion I Part (a) 1.SOURCE CODE LISTING for numb.docx
Question I Part (a) 1.SOURCE CODE LISTING for numb.docx
 
DSP Lab 1-6.pdf
DSP Lab 1-6.pdfDSP Lab 1-6.pdf
DSP Lab 1-6.pdf
 
Basic simulation lab manual1
Basic simulation lab manual1Basic simulation lab manual1
Basic simulation lab manual1
 
Dsp manual
Dsp manualDsp manual
Dsp manual
 
Fast Fourier Transform (FFT) of Time Series in Kafka Streams
Fast Fourier Transform (FFT) of Time Series in Kafka StreamsFast Fourier Transform (FFT) of Time Series in Kafka Streams
Fast Fourier Transform (FFT) of Time Series in Kafka Streams
 
Matlab kod taslağı
Matlab kod taslağıMatlab kod taslağı
Matlab kod taslağı
 
Exam 6 commlab 18_119_ei0292
Exam 6 commlab 18_119_ei0292Exam 6 commlab 18_119_ei0292
Exam 6 commlab 18_119_ei0292
 
Digitla Communication pulse shaping filter
Digitla Communication pulse shaping filterDigitla Communication pulse shaping filter
Digitla Communication pulse shaping filter
 
Dsp gcu lab11
Dsp gcu lab11Dsp gcu lab11
Dsp gcu lab11
 
Matlab Señales Discretas
Matlab Señales DiscretasMatlab Señales Discretas
Matlab Señales Discretas
 
bask, bfsk, bpsk
bask, bfsk, bpskbask, bfsk, bpsk
bask, bfsk, bpsk
 
Comm lab manual_final
Comm lab manual_finalComm lab manual_final
Comm lab manual_final
 
Comm lab manual_final-1
Comm lab manual_final-1Comm lab manual_final-1
Comm lab manual_final-1
 
matlab.docx
matlab.docxmatlab.docx
matlab.docx
 
Matlab fair-record-model
Matlab fair-record-modelMatlab fair-record-model
Matlab fair-record-model
 
Implementation of adaptive stft algorithm for lfm signals
Implementation of adaptive stft algorithm for lfm signalsImplementation of adaptive stft algorithm for lfm signals
Implementation of adaptive stft algorithm for lfm signals
 
Modulation techniques matlab_code
Modulation techniques matlab_codeModulation techniques matlab_code
Modulation techniques matlab_code
 
signal homework
signal homeworksignal homework
signal homework
 
Filter Implementation And Evaluation Project
Filter Implementation And Evaluation ProjectFilter Implementation And Evaluation Project
Filter Implementation And Evaluation Project
 
Matlab Homework Help
Matlab Homework HelpMatlab Homework Help
Matlab Homework Help
 

More from Minh Anh Nguyen

Chúc mừng năm mới 2018
Chúc mừng năm mới 2018Chúc mừng năm mới 2018
Chúc mừng năm mới 2018
Minh Anh Nguyen
 
Chuc Mung Nam Moi 2017- Dinh Dau
Chuc Mung Nam Moi 2017- Dinh DauChuc Mung Nam Moi 2017- Dinh Dau
Chuc Mung Nam Moi 2017- Dinh Dau
Minh Anh Nguyen
 
Happy New Year
Happy New Year Happy New Year
Happy New Year
Minh Anh Nguyen
 
Tutorial for EDA Tools
Tutorial for EDA ToolsTutorial for EDA Tools
Tutorial for EDA Tools
Minh Anh Nguyen
 
Sound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User ManualSound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User Manual
Minh Anh Nguyen
 
Tet trung thu -- Happy mid-autumn moon festival
Tet trung thu -- Happy mid-autumn moon festivalTet trung thu -- Happy mid-autumn moon festival
Tet trung thu -- Happy mid-autumn moon festival
Minh Anh Nguyen
 
An Introduction to HFSS:
An Introduction to HFSS:An Introduction to HFSS:
An Introduction to HFSS:
Minh Anh Nguyen
 
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITSSTUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
Minh Anh Nguyen
 
Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)
Minh Anh Nguyen
 
Maxwell3 d
Maxwell3 dMaxwell3 d
Maxwell3 d
Minh Anh Nguyen
 
Simulation results of induction heating coil
Simulation results of induction heating coilSimulation results of induction heating coil
Simulation results of induction heating coil
Minh Anh Nguyen
 
Audio detection system
Audio detection systemAudio detection system
Audio detection system
Minh Anh Nguyen
 
Love me tender
Love me tenderLove me tender
Love me tender
Minh Anh Nguyen
 
Ni myRio and Microphone
Ni myRio and MicrophoneNi myRio and Microphone
Ni myRio and Microphone
Minh Anh Nguyen
 
Results Review of iphone and Detecting of Human Errors Algorithm
Results Review of iphone and Detecting of Human Errors AlgorithmResults Review of iphone and Detecting of Human Errors Algorithm
Results Review of iphone and Detecting of Human Errors Algorithm
Minh Anh Nguyen
 
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Minh Anh Nguyen
 
The method of comparing two image files
 The method of comparing two image files The method of comparing two image files
The method of comparing two image files
Minh Anh Nguyen
 
A message for my uncle on father's day
A message for my uncle on father's dayA message for my uncle on father's day
A message for my uncle on father's day
Minh Anh Nguyen
 
CENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORSCENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORS
Minh Anh Nguyen
 
Paloma
PalomaPaloma

More from Minh Anh Nguyen (20)

Chúc mừng năm mới 2018
Chúc mừng năm mới 2018Chúc mừng năm mới 2018
Chúc mừng năm mới 2018
 
Chuc Mung Nam Moi 2017- Dinh Dau
Chuc Mung Nam Moi 2017- Dinh DauChuc Mung Nam Moi 2017- Dinh Dau
Chuc Mung Nam Moi 2017- Dinh Dau
 
Happy New Year
Happy New Year Happy New Year
Happy New Year
 
Tutorial for EDA Tools
Tutorial for EDA ToolsTutorial for EDA Tools
Tutorial for EDA Tools
 
Sound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User ManualSound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User Manual
 
Tet trung thu -- Happy mid-autumn moon festival
Tet trung thu -- Happy mid-autumn moon festivalTet trung thu -- Happy mid-autumn moon festival
Tet trung thu -- Happy mid-autumn moon festival
 
An Introduction to HFSS:
An Introduction to HFSS:An Introduction to HFSS:
An Introduction to HFSS:
 
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITSSTUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
STUCK-OPEN FAULT ANALYSIS IN CMOS TRANSISTOR BASED COMBINATIONAL CIRCUITS
 
Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)
 
Maxwell3 d
Maxwell3 dMaxwell3 d
Maxwell3 d
 
Simulation results of induction heating coil
Simulation results of induction heating coilSimulation results of induction heating coil
Simulation results of induction heating coil
 
Audio detection system
Audio detection systemAudio detection system
Audio detection system
 
Love me tender
Love me tenderLove me tender
Love me tender
 
Ni myRio and Microphone
Ni myRio and MicrophoneNi myRio and Microphone
Ni myRio and Microphone
 
Results Review of iphone and Detecting of Human Errors Algorithm
Results Review of iphone and Detecting of Human Errors AlgorithmResults Review of iphone and Detecting of Human Errors Algorithm
Results Review of iphone and Detecting of Human Errors Algorithm
 
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
Results Review of Microphone Prototype and LabView Detecting of Human Errors ...
 
The method of comparing two image files
 The method of comparing two image files The method of comparing two image files
The method of comparing two image files
 
A message for my uncle on father's day
A message for my uncle on father's dayA message for my uncle on father's day
A message for my uncle on father's day
 
CENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORSCENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORS
 
Paloma
PalomaPaloma
Paloma
 

Recently uploaded

Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 

Recently uploaded (20)

Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 

Matlab code for comparing two microphone files

  • 1. Contents  Matlab Code:  signal into left and right, stereo records  time for right signal only (stereo) for original signals  find new length  find new time  find new frequency  perform fft and plot of the cut orignal signal  Zoom in to signal baseline noise signal  plot two signals  plot fft compare  calculate and compare two signals  corlation Matlab Code: Author: Minh Anh Nguyen (minhanhnguyen@q.com) This script will perform the following tasks: %1. read in two "wav" files, plot the signals of these files %2. fft % 3. compare input signals, and display a message on the screen whether or not the signals are the same. % the MSE must be 0, for both signals are the same. % The script will read in a stereo data (right channel) close all;% Close all figures (except those of imtool.) clear all; % Erase all existing variables. clc;% Clear the command window. fontSize = 20; fontSize1 = 14; fontSize2 = 12; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Please edit files % set folder folder = 'C:UsersMinh anhDesktopmicrophone-project-demo'; %%Open WAV file: sound1=audioread('.good 2.wav'); [y1,fs1]=audioread('.good 2.wav'); sound2=audioread('.good 3.wav'); [y2,fs2]=audioread('.good 3.wav'); % sound2=audioread('.upper_channel 2.wav'); % [y2,fs2]=audioread('.upper_channel 2.wav'); % sound2=audioread('.upper_channel_bide 1.wav'); % [y2,fs2]=audioread('.upper_channel_bide 1.wav');
  • 2. % sound2=audioread('.lower_channel 1.wav'); % [y2,fs2]=audioread('.lower_channel 1.wav'); % sound2=audioread('.pin1.wav'); % [y2,fs2]=audioread('.pin1.wav'); sound1_baseline_noise=audioread('.good 2_noise.wav'); [y1_basenoise,fs1_basenoise]=audioread('.good 2_noise.wav'); % sound2_baseline_noise=audioread('.good 3_noise.wav'); [y2_basenoise,fs2_basenoise]=audioread('.good 3_noise.wav'); % sound2_baseline_noise=audioread('upper_channel 2_noise.wav'); % [y2_basenoise,fs2_basenoise]=audioread('.upper_channel 2_noise.wav'); % sound2_baseline_noise=audioread('upper_channel_bide 1_noise.wav'); % [y2_basenoise,fs2_basenoise]=audioread('.upper_channel_bide 1_noise.wav'); % sound2_baseline_noise=audioread('lower_channel 1_noise.wav'); % [y2_basenoise,fs2_basenoise]=audioread('.lower_channel 1_noise.wav'); % sound2_baseline_noise=audioread('.pin1_noise.wav'); % [y2_basenoise,fs2_basenoise]=audioread('.pin1_noise.wav'); signal into left and right, stereo records size(y1); left1=y1(:,1); right1=y1(:,2); [MR1,NR1] = size(right1); size(y2); left2=y2(:,1); right2=y2(:,2); [MR2,NR2] = size(right2); time for right signal only (stereo) for original signals Nl = length(right1); % number of points to analyze lsl = size (right1); % find the length of the data per second nbits = 2^(length(right1)); t1l = (0:1:length(right1)-1)/fs1; fx = fs1*(0:Nl/2-1)/Nl; %Prepare freq data for plot T1 = 1/fs1; % period between each sample N = Nl; N2 = length(right2); ls2 = size (right2); % find the length of the data per second nbits2 = 2^(length(right2)); t2 = (0:1:length(right2)-1)/fs2; fx2 = fs2*(0:N2/2-1)/N2; %Prepare freq data for plot T2 = 1/fs2; % period between each sample % baseline noise is removed from signals
  • 3. size(y1_basenoise); left1_basenoise=y1_basenoise(:,1); right1_basenoise=y1_basenoise(:,2); [MR1_basenoise,NR1_basenoise] = size(right1_basenoise); size(y2_basenoise); left2_basenoise=y2_basenoise(:,1); right2_basenoise=y2_basenoise(:,2); [MR2_basenoise,NR2_basenoise] = size(right2_basenoise); t1_basenoise = (0:1:length(right1_basenoise)-1)/fs1_basenoise; t2_basenoise = (0:1:length(right2_basenoise)-1)/fs2_basenoise; %%cut signal to the same length for comparing voice1 = right1(fs1*1 : fs1*40); voice2 = right2(fs2*1 : fs2*40); find new length N2x = length(voice2); N1x = length(voice1); find new time t1x = (0:1:length(voice1)-1)/fs1; t2x = (0:1:length(voice2)-1)/fs2; find new frequency f2x = fs2*(0:N2x/2-1)/N2x; f1x = fs1*(0:N1x/2-1)/N1x; perform fft and plot of the cut orignal signal NFFT1x = 2 ^ nextpow2(N1x); Y1x = fft(voice1, NFFT1x)/ N1x; f1xx = (fs1/ 2 * linspace(0, 1, NFFT1x / 2+1))'; % Vector containing frequencies in Hz STFFT1x = ( 2 * abs(Y1x(1: NFFT1x / 2+1))); % Vector containing corresponding amplitudes NFFT2x = 2 ^ nextpow2(N2x); Y2x = fft(voice2, NFFT2x) / N2x; f2xx = (fs2 / 2 * linspace(0, 1, NFFT2x / 2+1))'; % Vector containing frequencies in Hz STFFT2x = ( 2 * abs(Y2x(1: NFFT2x / 2+1))); % Vector containing corresponding amplitudes % plot of the cut orginal signal figure; subplot (2,2,1); plot(t1x, voice1);xlim([0,40]); ylim([-2,2]); %str1=sprintf('Correct loading with sampling rate = %d Hz, number sample = %d', fs1, N1x);
  • 4. str1=sprintf('Correct loading signal'); title(str1,'Fontsize', fontSize2); xlabel('Time (sec)','Fontsize', fontSize1); ylabel('Amplitude','Fontsize', fontSize1); grid on; subplot (2,2,2); plot(t2x, voice2); xlim([0,40]); ylim([-2,2]); %str2=sprintf(' User loading with sampling rate = %d Hz, number sample = %d', fs2, N2x); str2=sprintf('User loading signal'); title(str2,'Fontsize', fontSize2); xlabel('Time (sec)','Fontsize', fontSize1); ylabel('Amplitude','Fontsize', fontSize1); grid on; % plot of the fft cut signal2 %subplot (2,2,3); plot(f1xx, STFFT1x); xlim([0,1500]); ylim([0,.09]); figure; plot(f1xx, STFFT1x); xlim([0,1500]); ylim([0,.09]); str1ft1=sprintf('Single-sided Power spectrum for Correct loading'); title(str1ft1,'Fontsize', fontSize2); ylabel ('Magnitude','Fontsize', fontSize1); xlabel ('Frequency [Hz]','Fontsize', fontSize1); grid on; % display markers at specific data points on DFT graph indexmin1 = find(min(STFFT1x) == STFFT1x); xmin1 = f1xx(indexmin1); ymin1 = STFFT1x(indexmin1); indexmax1 = find(max(STFFT1x) == STFFT1x); xmax1 = f1xx(indexmax1); ymax1 = STFFT1x(indexmax1); strmax1 = ['Frequency = ',num2str(xmax1),' Hz',' ','Magnitude=', num2str(ymax1),'']; text(xmax1,ymax1,strmax1,'HorizontalAlignment','Left'); %subplot (2,2,4); plot(f2xx, STFFT2x); xlim([0,1500]); ylim([0,.09]); figure; plot(f2xx, STFFT2x); xlim([0,1500]); ylim([0,.09]); str1ft2=sprintf('Single-sided Power spectrum for User loading'); title(str1ft2,'Fontsize', fontSize2); ylabel ('Magnitude', 'Fontsize', fontSize1); xlabel ('Frequency [Hz]','Fontsize', fontSize1); grid on; % display markers at specific data points on DFT graph indexmin2 = find(min(STFFT2x) == STFFT2x); xmin2 = f2xx(indexmin2); ymin2 = STFFT2x(indexmin2); indexmax2 = find(max(STFFT2x) == STFFT2x); xmax2 = f2xx(indexmax2); ymax2 = STFFT2x(indexmax2); strmax2 = ['Frequency = ',num2str(xmax2),' Hz',' ','Magnitude =', num2str(ymax2),' ']; text(xmax2,ymax2,strmax2,'HorizontalAlignment','Left');
  • 5.
  • 6. Zoom in to signal baseline noise signal figure; subplot(3,2,1); plot(t1_basenoise,right1_basenoise); xlim([0,10]); ylim([-2,2]); str1=sprintf('Correct loading with Zoom in'); title(str1,'Fontsize', fontSize1); xlabel('Time (secs)','Fontsize', fontSize1); ylabel('Amplitude','Fontsize', fontSize1); grid on; subplot(3,2,3); plot(t2_basenoise,right2_basenoise,'r'); xlim([0,10]); ylim([-2,2]); str2=sprintf('User loading with Zoom in'); title(str2, 'Fontsize', fontSize1); xlabel('Time (secs)','Fontsize', fontSize1); ylabel('Amplitude','Fontsize', fontSize1); grid on;
  • 7. plot two signals figure, plot(t1_basenoise,right1_basenoise, t2_basenoise,right2_basenoise,'r'); xlim([0,10]); ylim([-2,2]); str2=sprintf('Comparing two loading signals with Zoom in '); title(str2, 'Fontsize', fontSize1); xlabel('Time (secs)','Fontsize', fontSize1); ylabel('Amplitude','Fontsize', fontSize1); grid on; legend ('Correct loading signal', 'User loading signal', 'Fontsize', fontSize); Warning: Using an integer to specify the legend location is not supported. Specify the legend location with respect to the axes using the 'Location' parameter. Warning: Ignoring extra legend entries.
  • 8. plot fft compare figure, plot(f1xx, STFFT1x,f2xx, STFFT2x,'r'); xlim([0,1500]); ylim([0,.09]); str1ft3=sprintf('Comparing FFT for two loading signals'); title(str1ft3,'Fontsize', fontSize1); ylabel ('Magnitude', 'Fontsize', fontSize1); xlabel ('Frequency [Hz]','Fontsize', fontSize1); grid on; indexmax3 = find(max(STFFT2x) == STFFT2x); xmax3 = f2xx(indexmax3); ymax3 = STFFT2x(indexmax3); strmax3 = ['Frequency = ',num2str(xmax3),' Hz',' ','Magnitude= ', num2str(ymax3),' ']; legend ('Correct loading signal', 'User loading signal','Fontsize', fontSize); Warning: Using an integer to specify the legend location is not supported. Specify the legend location with respect to the axes using the 'Location' parameter. Warning: Ignoring extra legend entries.
  • 9. calculate and compare two signals Calculate the MSE D= voice1 - voice2; MSE=mean(D.^2); %msgbox(strcat('MSE value is= ',mat2str(),' MSE')); %msgbox(strcat('MSE value is= ',mat2str(MSE))); %if MSE ==0; %if MSE <= 0.00135; %%v this will work if MSE <= 5.2731e-09 ; %%v this will work disp('Signal are the same'); else % msgbox(strcat('MSE value is= ',mat2str(MSE))); disp('Signal are not the same'); msgbox('Centrifuge loading error. Please check bearings are seated properly'); end % %% play back play back the audio files % disp('Playing (correctly loaded).'); % sound(y1,fs1); % pause; %create a 2 second pause % %
  • 10. % disp('Playing the user loading.'); % sound(y2,fs2); % pause %%Calculate variance, mean and standard deviation of sounds D1c= STFFT1x - STFFT2x; MSEfft=mean(D1c.^2); disp(['MSEfft' num2str(MSEfft)]); mean1= sum(right1)/N; mean2= sum(right2)/N2; stdev1 = sqrt ((sum(right1-mean1).^2)/2); stdev2 = sqrt ((sum(right2-mean2).^2)/2); % var(right1(1:length(right2))-right2) %for the whole signal y1-y2 var(voice1(1:length(voice2))-voice2); %for the voice fprintf('digital statitics of voice 1 a same length signalnn'); fprintf('mean of voice 1:%fn', mean(voice1)); fprintf('standard deviation of voice 1:%fn', std(voice1)); fprintf('variance of voice 1:%fn', std(voice1)^2); fprintf('average power of voice 1:%fn', mean(voice1.^2)); fprintf('average magnitude of voice 1:%fn', mean(abs(voice1))); % prod1 = sound1(1:N-1) * sound1(2:N); % crossing1 = length (find(prod1<0)); % fprintf(' zero crossing of sound 1:% 0.fn', crossing1); % fprintf('ndigital statitics of voice 2nn'); fprintf('mean of voice 2:%fn', mean(voice2)); fprintf('standard deviation of voice 2:%fn', std(voice2)); fprintf('variance of voice 2:%fn', std(voice2)^2); fprintf('average power of voice 2:%fn', mean(voice2.^2)); fprintf('average magnitude of voice 2:%fn', mean(abs(voice2))); % prod1 = sound1(1:N-1) * sound1(2:N); % crossing1 = length (find(prod1<0)); % fprintf(' zero crossing of sound 1:% 0.fn', crossing1); % % % var(right1(1:length(right2))-right2) %for the whole signal y1-y2 % var(voice1(1:length(voice2))-voice2); %for the voice % % Signal are the same MSEfft0 digital statitics of voice 1 a same length signal mean of voice 1:-0.000105 standard deviation of voice 1:0.251742 variance of voice 1:0.063374 average power of voice 1:0.063374 average magnitude of voice 1:0.197595
  • 11. digital statitics of voice 2 mean of voice 2:-0.000105 standard deviation of voice 2:0.251742 variance of voice 2:0.063374 average power of voice 2:0.063374 average magnitude of voice 2:0.197595 correlation [C1, lag1] = xcorr(abs((fft(voice1))),abs((fft(voice2)) )); figure, plot(lag1/fs1,C1); ylabel('Amplitude'); grid on title('Cross-correlation between Correct and User loading files') % %% plot orginal signal. for debug. %% team does not like long length % %% perform fft and plot of orignal signal % % % figure; subplot (2,2,1); plot(t1, sound1); % title ('Signal of sound 1 , frequency = 44100 Hz and number sample = 2742270'); % xlabel('time (sec)'); ylabel('relative signal strength'); grid on; % % % subplot (2,2,2); plot(t2, sound2); % title ('Signal of sound 2, frequency = 44100 Hz and number sample = 2674665'); % xlabel('time (sec)'); ylabel('relative signal strength'); grid on; % %% fft of orignal signal % NFFT1 = 2 ^ nextpow2(N); % Y1 = fft(y1, NFFT1)/ N; % f1 = (fs1 / 2 * linspace(0, 1, NFFT1 / 2+1))'; % Vector containing frequencies in Hz % STFFT1 = ( 2 * abs(Y1(1: NFFT1 / 2+1))); % Vector containing corresponding amplitudes % subplot (2,2,3); plot(f1, STFFT1); title ('Single-sided Power spectrum for Sound1'); % %subplot (2,2,3); plot(abs(fft(sound1))); title ('plot fft of Sound 1'); %plot Magnitude of fft % ylabel ('Magnitude |y(f)|'); xlabel ('frequency [Hz]'); grid on; % % NFFT2 = 2 ^ nextpow2(N2); % Y2 = fft(y2, NFFT2) / N2; % f2 = (fs2 / 2 * linspace(0, 1, NFFT2 / 2+1))'; % Vector containing frequencies in Hz % STFFT2 = ( 2 * abs(Y2(1: NFFT2 / 2+1))); % Vector containing corresponding amplitudes % subplot (2,2,4); plot(f2, STFFT2); title ('Single-sided Power spectrum for Sound2'); % % subplot (2,2,4); plot(abs(fft(sound2))); title ('plot fft of Sound2'); % ylabel ('Magnitude |y(f)|'); xlabel ('frequency [Hz]'); grid on;