4/8/24 6:06 PM C:\Users\Ninad\Documents\MATLAB\Exp1b.
m 1 of 1
%Frequency content of Audio Signal
% Ninad Lomte
% 1032222545
clc;
clear all;
close all;
[y,Fs] = audioread('[Link]');
disp(Fs);
L = length(y)
%Continuous Signal
t =0:L-1;
subplot(4,1,1);
plot(t,y);
title('Original File');
xlabel("Time Period");
ylabel("Amplitude");
%Frequency Response
n = 0:L-1;
y1 = fft(y,L)
y1mag = abs(y1)
subplot(4,1,2);
stem(n,y1mag);
title("DFT");
xlabel("Time Period");
ylabel("Amplitude");
%Display small segment of original signal
u=12
disp(['u=',num2str(u)]);
xlen1 = ceil((L)/u);
disp(['xlen1',num2str(xlen1)]);
v=1;
disp(['v=',num2str(v)]);
for r=1:xlen1
p1(r) = y((v-1)*xlen1+r);
end
t1 = (0:length(p1)-1);
subplot(4,1,3);
plot(t1,p1);
xlabel("Time Period");
ylabel('p1(n)');
%FFT
p1FFT = abs(fft(p1,xlen1));
n =0:xlen1-1;
subplot(4,1,4);
stem(n,p1FFT);
xlabel("Discrete Frequency k");
ylabel('p1FFT(k)');