The original “abracadabras” signals at 44100Hz sampling frequency.
Compute spectrum of abracadabras for sampling frequency at 44100Hz.
Perform the average of 10 abracadabras and then
plot the spectrum of 10 abracadabras for sampling frequency at 44100Hz
Perform average spectrum of 10 abracadabras
Re-record, sample at 8 KHz.
Compute
spectrum of abracadabras for sample frequency 8Khz
Matlab code
%Minh Anh Nguyen
%ECE/BIOM 537 Biomedical
Signal Processing, Colorado
State University
%Email:
minhanhnguyen@q.com
%Homework 5
close all;
clc;
figure;
%Read in the sound
%returns the sample
rate(FS) in Hertz
%N = number sample
%the number of bits per
sample (BITS) used to encode the data in the file
ax(1)= subplot (3,2,1);
%myvoice1 =
audioread('J:\BIOM_Signal_processing\HW2\Aka1_a.wma');
%[y1, fs1] =
audioread('J:\BIOM_Signal_processing\HW2\Aka1_a.wma');
myvoice1 = audioread('J:\BIOM_Signal_processing\HW2\Aka1_a.wma');
[y1, fs1] = audioread('J:\BIOM_Signal_processing\HW2\Aka1_a.wma');
N = length(myvoice1);
%%player=audioplayer(y1,N);
play(player)
t1 = (0:1:N-1)/fs1;
plot(t1, myvoice1);
title ('My voice
[Abrakakabra]#1 Number of sample 229364')
xlabel('time (sec)');
ylabel(' signal
strength')
axis tight
grid on;
ax(2)=subplot (3,2,2);
myvoice2 = audioread('J:\BIOM_Signal_processing\HW2\ala_2.wma');
[y2, fs2] = audioread('J:\BIOM_Signal_processing\HW2\ala_2.wma');
N2 = length(myvoice2);
t2 =
(0:1:length(myvoice2)-1)/fs2;
plot(t2, myvoice2);
title ('My voice
[repeat Abrakakabra]#2 Number sample 370661')
xlabel('time (sec)');
ylabel(' signal
strength')
axis tight
grid on;
ax(3)=subplot (3,2,3);
myvoice3 = audioread('J:\BIOM_Signal_processing\HW2\alka3.wma');
[y3, fs3] = audioread('J:\BIOM_Signal_processing\HW2\alka3.wma');
N3 = length(myvoice3);
t3 =
(0:1:length(myvoice3)-1)/fs3;
plot(t3, myvoice3);
title ('My voice
[repeat Abrakakabra]#3 number of sample 376790')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
ax(4)= subplot (3,2,4);
myvoice4 = audioread('J:\BIOM_Signal_processing\HW2\Alka_4.wma');
[y4, fs4] = audioread('J:\BIOM_Signal_processing\HW2\Alka_4.wma');
N4 = length(myvoice4);
t4 =
(0:1:length(myvoice4)-1)/fs4;
plot(t4, myvoice4);
title ('My voice
[repeat Abrakakabra]#4 Number of sample 247798')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
ax(5)= subplot (3,2,5);
myvoice5 = audioread('J:\BIOM_Signal_processing\HW2\Alka_5.wma');
[y5, fs5]= audioread('J:\BIOM_Signal_processing\HW2\Alka_5.wma');
N5 = length(myvoice5);
t5 =
(0:1:length(myvoice5)-1)/fs5;
plot(t5, myvoice5);
title ('My voice
[repeat Abrakakabra]#5 number of sample 266232')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
ax(5)= subplot (3,2,6);
%ax(6)= subplot (2,2,1);
myvoice6 = audioread('J:\BIOM_Signal_processing\HW2\Aka_6.wma');
[y6, fs6] = audioread('J:\BIOM_Signal_processing\HW2\Aka_6.wma');
N6 = length(myvoice6);
t6 =
(0:1:length(myvoice6)-1)/fs6;
plot(t6, myvoice6);
title ('My voice
[repeat Abrakakabra]#6 number of sample 241624')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
figure;
ax(7)=subplot (2,2,1);
myvoice7 = audioread('J:\BIOM_Signal_processing\HW2\alk_7.wma');
[y7, fs7] = audioread('J:\BIOM_Signal_processing\HW2\alk_7.wma');
N7 = length(myvoice7);
t7 =
(0:1:length(myvoice7)-1)/fs7;
plot(t7, myvoice7);
title ('My voice
[repeat Abrakakabra]#7 number of sample 303099')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
ax(8)=subplot (2,2,2);
myvoice8 = audioread('J:\BIOM_Signal_processing\HW2\alk8.wma');
[y8, fs8] = audioread('J:\BIOM_Signal_processing\HW2\alk8.wma');
N8 = length(myvoice8);
t8 =
(0:1:length(myvoice8)-1)/fs8;
plot(t8, myvoice8);
title ('My voice
[repeat Abrakakabra]#8 number of sample 270333 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%figure;
ax(8)=subplot (2,2,3);
myvoice9 = audioread('J:\BIOM_Signal_processing\HW2\ala_9.wma');
[y9, fs9] = audioread('J:\BIOM_Signal_processing\HW2\ala_9.wma');
N9 = length(myvoice9);
t9 =
(0:1:length(myvoice9)-1)/fs9;
plot(t9, myvoice9);
title ('My voice
[repeat Abrakakabra]#9 number of sample 206829 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%figure;
ax(9)=subplot (2,2,4);
myvoice10 = audioread('J:\BIOM_Signal_processing\HW2\aka_10.wma');
[y10, fs10] = audioread('J:\BIOM_Signal_processing\HW2\aka_10.wma');
N10 = length(myvoice10);
t10 =
(0:1:length(myvoice10)-1)/fs10;
plot(t10, myvoice10);
title ('My voice
[repeat Abrakakabra]#10 number of sample 169961 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Compute the power
spectral density, a measurement of the energy at various frequencies
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N);
Y = fft(y1, NFFT) / N;
f = (fs1 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure;
ax(10)= subplot (4,2,1);
plot (f, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#1 Number of sample
229364')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N2);
Y2 = fft(y2, NFFT) / N2;
f2 = (fs2 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y2(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
ax(11)= subplot (4,2,2);
plot (f2, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#2 Number of sample
370661')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N3);
Y3 = fft(y3, NFFT) / N3;
f3 = (fs3 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y3(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
ax(12)= subplot (4,2,3);
plot (f3, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#3 Number of sample
376790')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N4);
Y4 = fft(y4, NFFT) / N4;
f4 = (fs4 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y4(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
ax(13)= subplot (4,2,4);
plot (f4, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#4 Number of sample
247798')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N5);
Y5 = fft(y5, NFFT) / N5;
f5 = (fs5 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y5(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
ax(14)= subplot (4,2,5);
plot (f5, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#5 Number of sample
266232')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N6);
Y6 = fft(y6, NFFT) / N6;
f6 = (fs6 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y6(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
ax(16)= subplot (4,2,6);
plot (f6, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#6 Number of sample
241624')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
figure;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N7);
Y7 = fft(y7, NFFT) / N7;
f7 = (fs7 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y7(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
ax(17)= subplot (5,2,1);
plot (f7, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#7 Number of sample
303099')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N8);
Y8 = fft(y8, NFFT) / N8;
f8 = (fs8 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y8(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
ax(18)= subplot (5,2,2);
plot (f8, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#8 Number of sample
270333')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N9);
Y9 = fft(y9, NFFT) / N9;
f9 = (fs9 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y9(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
ax(19)= subplot (5,2,3);
plot (f9, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#9 Number of sample
206829')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(N10);
Y10 = fft(y10, NFFT) / N10;
f10 = (fs10 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(Y10(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
ax(20)= subplot (5,2,4);
plot (f10, amp);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#10 Number of sample
169961')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
figure;
%subplot (6,2,1);
%%%Average spectrum of 10
abracadabras
X1 = fft(y1);
X1 = X1(1:length(X1)/2+1); %
One-sided DFT
P = (abs(X1)/length(y1)).^2; % Compute the mean-square power
P(2:end-1) = 2*P(2:end-1); % Factor
of two for one-sided estimate
% at all frequencies except
zero and the Nyquist
Hmss = dspdata.msspectrum(P,'Fs',fs1,'spectrumtype','onesided');
plot(Hmss) % Plot the mean-square spectrum.
figure;
%subplot (6,2,1);
%%%Average spectrum of 10
abracadabras
X1_2 = fft(y2);
X1_2 = X1_2(1:length(X1)/2+1); %
One-sided DFT
P =
(abs(X1_2)/length(y2)).^2; % Compute
the mean-square power
P(2:end-1) = 2*P(2:end-1); % Factor
of two for one-sided estimate
% at all frequencies except
zero and the Nyquist
Hmss = dspdata.msspectrum(P,'Fs',fs1,'spectrumtype','onesided');
plot(Hmss) % Plot the mean-square spectrum.
%(i) Using the program of
your choice, average your 10 "abracadabras" from your previous
%assignment, and plot the result. Be sure to line up the signals prior to the
averaging operation. %Submit your code with your plot.
%% line up the signals
prior to the averaging operation
y2new = y2(:,1); %% create signal in 1D
y1new = y1(:,1); %% signal 1
y3new = y3(:,1); %% create signal in 1D
y4new = y4(:,1); %% create signal in 1D
y5new = y5(:,1); %% create signal in 1D
y6new = y6(:,1); %% create signal in 1D
y7new = y7(:,1); %% create signal in 1D
y8new = y8(:,1); %% create signal in 1D
y9new = y9(:,1); %% create signal in 1D
y10new =y10(:,1); %% create signal in 1D
%time average of 1
“abracadabra” with ensemble average of all.
vshift1 = circshift (y1new,
20333);
vshift2 = circshift (y2new,
-41806);
vshift3 = circshift (y3new,
20333);
vshift4 = circshift (y4new,
20333);
vshift5 = circshift (y5new,
20333);
vshift6 = circshift (y6new,
20333);
vshift7 = circshift (y7new,
20333);
vshift8 = circshift (y8new,
20333);
vshift9 = circshift (y9new,
20333);
%vshift10 = circshift
(y10new, 20333);
vshiftcut1 = vshift1(1: 169961);
vshiftcut2 = vshift2(1: 169961);
vshiftcut3 = vshift3(1: 169961);
vshiftcut4 = vshift4(1: 169961);
vshiftcut5 = vshift5(1: 169961);
vshiftcut6 = vshift6(1: 169961);
vshiftcut7 = vshift7(1: 169961);
vshiftcut8 = vshift8(1: 169961);
vshiftcut9 = vshift9(1: 169961);
S = [vshiftcut1(:),
vshiftcut2(:), vshiftcut3(:), vshiftcut4(:), vshiftcut5(:), vshiftcut6(:),
vshiftcut7(:), vshiftcut8(:), vshiftcut9(:), y10new(:)];
MeanS = mean(S');
figure,
plot (MeanS);
title ('ensemble
average of all my voice [repeat
Abrakakabra]')
xlabel('time (sec)');
ylabel('signal strength');
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(S));
YS = fft(S, NFFT) / length(S);
fS = (fs10 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp = ( 2 * abs(YS(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure,
plot (fS, amp);
title ('plot
single-sided amplitude spectrume of average 10 [Abrakakabra]')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
% Plot the mean-square
spectrum.
figure;
%subplot (6,2,1);
%%%Average spectrum of 10
abracadabras
XS = fft(S);
XS = XS(1:length(XS)/2+1); %
One-sided DFT
P = (abs(XS)/length(S)).^2; % Compute the mean-square power
P(2:end-1) = 2*P(2:end-1); % Factor
of two for one-sided estimate
% at all frequencies except
zero and the Nyquist
Hmss = dspdata.msspectrum(P,'Fs',fs1,'spectrumtype','onesided');
plot(Hmss) % Plot the mean-square spectrum.
%calculate the StDev:
StdS = std(S');
fsorg=44100;
fs = 8000;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_1 = resample(y1,fs,fsorg);
N1_1 = length(y_1);
t1_1 = (0:1:length(y_1)-1)/fs;
plot(t1_1, y_1);
title ('Abrakakabra
#1 for 8Khz, number of sample 41608 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_2 = resample(y2,fs,fsorg);
N1_2 = length(y_2);
t1_2 = (0:1:length(y_2)-1)/fs;
plot(t1_2, y_2);
title ('Abrakakabra
#2 for 8Khz, number of sample 67241 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_3 = resample(y3,fs,fsorg);
N1_3 = length(y_3);
t1_3 = (0:1:length(y_3)-1)/fs;
plot(t1_3, y_3);
title ('Abrakakabra
#3 for 8Khz, number of sample 68352 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_4 = resample(y4,fs,fsorg);
N1_4 = length(y_4);
t1_4 = (0:1:length(y_4)-1)/fs;
plot(t1_4, y_4);
title ('Abrakakabra
#4 for 8Khz, number of sample 44953 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_5 = resample(y5,fs,fsorg);
N1_5 = length(y_5);
t1_5 = (0:1:length(y_5)-1)/fs;
plot(t1_5, y_5);
title ('Abrakakabra
#5 for 8Khz, number of sample 48297 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_6 = resample(y6,fs,fsorg);
N1_6 = length(y_6);
t1_6 = (0:1:length(y_6)-1)/fs;
plot(t1_6, y_6);
title ('Abrakakabra
#6 for 8Khz, number of sample 43833 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_7 = resample(y7,fs,fsorg);
N1_7 = length(y_7);
t1_7 = (0:1:length(y_7)-1)/fs;
plot(t1_7, y_7);
title ('Abrakakabra
#7 for 8Khz, number of sample 54984 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_8 = resample(y8,fs,fsorg);
N1_8 = length(y_8);
t1_8 = (0:1:length(y_8)-1)/fs;
plot(t1_8, y_8);
title ('Abrakakabra
#8 for 8Khz, number of sample 49040 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_9 = resample(y9,fs,fsorg);
N1_9 = length(y_9);
t1_9 = (0:1:length(y_9)-1)/fs;
plot(t1_9, y_9);
title ('Abrakakabra
#9 for 8Khz, number of sample 37520 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%% resample is your function. To downsample
signal from 44100 Hz to 8000 Hz:
%(the "1" and
"2" arguments define the resampling ratio: 8000/44100 = 1/2)
%To upsample back to 44100
Hz: x2 = resample(y,2,1);
figure;
y_10 = resample(y10,fs,fsorg);
N1_10 = length(y_10);
t1_10 = (0:1:length(y_10)-1)/fs;
plot(t1_10, y_10);
title ('Abrakakabra
#10 for 8Khz, number of sample 30832 ')
xlabel('time (sec)');
ylabel('signal
strength')
axis tight
grid on;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%Compute the power
spectral density, a measurement of the energy at various frequencies
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(y_1));
Y_1 = fft(y_1, NFFT) / length
(y_1);
f_1 = (fs / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_1 = ( 2 * abs(Y_1(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure;
plot (f_1, amp_1);
title ('plot
single-sided amplitude spectrume of Abrakakabra #1 at 8Khz')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(y_2));
Y_2 = fft(y_2, NFFT) /
length(y_2);
f_2 = (fs / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_2 = ( 2 * abs(Y_2(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure;
plot (f_2, amp_2);
title ('plot
single-sided amplitude spectrume of [Abrakakabra]#2 at 8Khz')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(y_3));
Y_3 = fft(y_3, NFFT) /
length(y_3);
f_3 = (fs3 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_3 = ( 2 * abs(Y3(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure;
plot (f_3, amp_3);
title ('plot
single-sided amplitude spectrume of [Abrakakabra]#3 at 8Khz')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(y_4));
Y_4 = fft(y_4, NFFT) /
length(y_4);
f_4 = (fs4 / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_4 = ( 2 * abs(Y_4(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure;
plot (f_4, amp_4);
title ('plot
single-sided amplitude spectrume of
[Abrakakabra]#4 at 8Khz')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
figure;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(y_5));
Y_5 = fft(y_5, NFFT) /
length(y_5);
f_5 = (fs / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_5 = ( 2 * abs(Y_5(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
plot (f_5, amp_5);
title ('plot
single-sided amplitude spectrume of [Abrakakabra]#5 at 8Khz')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(y_6));
Y_6 = fft(y_6, NFFT) /
length(y_6);
f_6 = (fs / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_6 = ( 2 * abs(Y_6(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure;
plot (f_6, amp_6);
title ('plot
single-sided amplitude spectrume of
[Abrakakabra]#6 at 8Khz')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
figure;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(y_7));
Y_7 = fft(y_7, NFFT)
/length(y_7);
f_7 = (fs / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_7 = ( 2 * abs(Y_7(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
plot (f_7, amp_7);
title ('plot
single-sided amplitude spectrume of
[Abrakakabra]#7 at 8Khz')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(y_8));
Y_8 = fft(y_8, NFFT) /
length(y_8);
f_8 = (fs / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_8 = ( 2 * abs(Y_8(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure;
plot (f_8, amp_8);
title ('plot
single-sided amplitude spectrume of [Abrakakabra]#8 at 8Khz')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^ nextpow2(length(y_9));
Y_9 = fft(y_9, NFFT) /
length(y_9);
f_9 = (fs / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_9 = ( 2 * abs(Y_9(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure;
plot (f_9, amp_9);
title ('plot
single-sided amplitude spectrume of my voice [Abrakakabra]#9 Number of sample
206829')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
%%% DFT to describe the signal in the frequency
NFFT = 2 ^
nextpow2(length(y_10));
Y_10 = fft(y_10, NFFT) /
length(y_10);
f_10 = (fs / 2 * linspace(0, 1,
NFFT / 2+1))'; % Vector containing frequencies in Hz
amp_10 = ( 2 * abs(Y_10(1: NFFT /
2+1))); % Vector containing corresponding amplitudes
figure;
plot (f_10, amp_10);
title ('plot
single-sided amplitude spectrume of
[Abrakakabra]#10 at 8Khz')
xlabel ('frequency
(Hz)')
ylabel ('|y(f)|')
grid on;
No comments:
Post a Comment