SlideShare a Scribd company logo
1 of 12
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 InterpolationFernando Ojeda
 
Signal Prosessing Lab Mannual
Signal Prosessing Lab Mannual Signal Prosessing Lab Mannual
Signal Prosessing Lab Mannual Jitendra Jangid
 
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 TransformAmr E. Mohamed
 
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 TransformAmr 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 TransformAmr 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 DesignAmr 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 studentsUR11EC098
 
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 MATLABMartin Wachiye Wafula
 
Dsp U Lec10 DFT And FFT
Dsp U   Lec10  DFT And  FFTDsp U   Lec10  DFT And  FFT
Dsp U Lec10 DFT And FFTtaha25
 
Digital Signal Processing
Digital Signal ProcessingDigital Signal Processing
Digital Signal ProcessingSandip 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 & Systemstaha25
 
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 SignalsAmr 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 seriesMax 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-phpapp01Rimple Mahey
 
Manifold learning
Manifold learningManifold learning
Manifold learningWei 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
 
Fourier series example
Fourier series exampleFourier series example
Fourier series exampleAbi finni
 
Manifold Learning
Manifold LearningManifold Learning
Manifold LearningPhong 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 beginnersMurshida 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 & ScientistsRay Phan
 
MATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi SharmaMATLAB Programs For Beginners. | Abhi Sharma
MATLAB Programs For Beginners. | Abhi SharmaAbee Sharma
 

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.docxcatheryncouper
 
Basic simulation lab manual1
Basic simulation lab manual1Basic simulation lab manual1
Basic simulation lab manual1Janardhana Raju M
 
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 StreamsHostedbyConfluent
 
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_ei0292lucky859450
 
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 lab11Jannat41
 
bask, bfsk, bpsk
bask, bfsk, bpskbask, bfsk, bpsk
bask, bfsk, bpskblzz2net
 
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 signalseSAT Journals
 
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
 

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-1
Comm lab manual_final-1Comm lab manual_final-1
Comm lab manual_final-1
 
Comm lab manual_final
Comm lab manual_finalComm lab manual_final
Comm lab manual_final
 
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 2018Minh 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 DauMinh Anh Nguyen
 
Sound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User ManualSound and Vibration Toolkit User Manual
Sound and Vibration Toolkit User ManualMinh 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 festivalMinh 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 CIRCUITSMinh Anh Nguyen
 
Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)Electrocardiogram (ECG or EKG)
Electrocardiogram (ECG or EKG)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 coilMinh 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 AlgorithmMinh 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 filesMinh 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 dayMinh Anh Nguyen
 
CENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORSCENTRIFUGE LOADING HUMAN FACTORS
CENTRIFUGE LOADING HUMAN FACTORSMinh Anh Nguyen
 

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

Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 

Recently uploaded (20)

Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .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;