% SURAJ BASTOLA %%%%%%%%%%%%
%%% Low Pass Filter %%%%%%%%%%
% IN MATLAB, Fs takes default value of 8000 %%%%%%%%%%%
clc;
clear all;
close all;
[y,Fs] = audioread('C:\Users\suraj\OneDrive\Documents\MIT COLLEGE\Software Defined Radio Communication\MATLAB COding\audioRecorded.wav');
z = abs(fft(y));
disp(z);
figure(1)
subplot(2,3,1)
plot(y)
title('Original Recorded Audio')
t = (0:length(y)-1)/Fs;
% ================ Low pass filter using Chebyshev Window==============
% I have used 34th order FIR low pass filter
% which has cut-off frequency0.48 and Chebyshev window with 30dB of ripple
blo = fir1(34,0.48,chebwin(35,30));
outlo = filter(blo,1,y);
ys = ylim;
subplot(2,3,2)
plot(t,outlo)
title('Lowpass Filtered Signal')
xlabel('Time (s)')
ylim(ys)
% ================ Low pass filter using Hamming Window==============
ord = 46;
low = 0.4;
bnd = [0.6 0.9];
bM = fir1(ord, [low bnd]);
Hamming = filter(bM,1,y);
subplot(2,3,3)
plot(t, Hamming)
title('Hamming window')
%=================== Low pass filter using Hamming Window==========
hM = fir1(ord,[low bnd],'DC-0',hann(ord+1));
Hanning = filter(hM,1,y);
subplot(2,3,4)
plot(t, Hanning)
title('Hanning window')
hfvt = fvtool(blo,1,bM,1,hM,1);
hfvt = fvtool(outlo,1,Hamming,1,Hanning,1);
legend(hfvt,'Chebwin','Hamming','Hanning')
No comments:
Post a Comment