You are on page 1of 9

Gamboa, Kurl Vincent P.

ECEA108L / E01

Laboratory Experiment #6

1. A)
Syntax:

GAMBOA=audiorecorder(11025,16,1)
display("Begin speaking");
recordblocking(GAMBOA,8);
display("End of Recording");
play(GAMBOA)
save GAMBOA
y=getaudiodata(GAMBOA);
plot(y,'r');

B)
2.

Syntax

Fs=11025;
[B,A] = fir1(5,[1000]/(Fs/2),'low')
zplane(B,A);
[a,n] = impz (B,A);
stem(n,a,'r')
title('Impulse Response');
xlabel('n(samples)');
ylabel('Amplitude');
[h,g] = freqz(B,A);
plot (g * Fs/(2*pi),abs(h),'r')
title ('Magnitude Response');
xlabel('Frequency(Hz)');
ylabel('Magnitude');

%2b
Fs=11025;
LPFData = filter(B,A,y);
LPFMag = fft(LPFData);
plot(abs(LPFMag(1:40000)),'r')
title('FFT audio file under Low Pass');
xlabel('Frequency(HZ)');
ylabel('Magnitude');
LPFcheck = audioplayer(LPFData,Fs)
play (LPFcheck)
3.

%3a
Fs=11025;
[B,A] = fir1(6,[2500]/(Fs/2),'high')
zplane(B,A);
[a,n] = impz (B,A);
stem(n,a,'r')
title('Impulse Response');
xlabel('n(samples)');
ylabel('Amplitude');
[h,g] = freqz(B,A);
plot (g * Fs/(2*pi),abs(h),'r')
title ('Magnitude Response');
xlabel('Frequency(Hz)');
ylabel('Magnitude');
%3b
Fs=11025;
HPFData = filter(B,A,y);
HPFMag = fft(HPFData);
plot(abs(HPFMag(1:40000)),'r')
title('FFT audio file under High Pass');
xlabel('Frequency(HZ)');
ylabel('Magnitude');
HPFcheck = audioplayer(HPFData,Fs)
play (HPFcheck)
4.

%4a
Fs=11025;
[B,A] = fir1(15,[2000 3000]/(Fs/2),'bandpass')
zplane(B,A);
[a,n] = impz (B,A);
stem(n,a,'r')
title('Impulse Response');
xlabel('n(samples)');
ylabel('Amplitude');
[h,g] = freqz(B,A);
plot (g * Fs/(2*pi),abs(h),'r')
title ('Magnitude Response');
xlabel('Frequency(Hz)');
ylabel('Magnitude');
%4b
Fs=11025;
BPFData = filter(B,A,y);
BPFMag = fft(BPFData);
plot(abs(LPFMag(1:40000)),'r')
title('FFT audio file under Low Pass');
xlabel('Frequency(HZ)');
ylabel('Magnitude');
BPFcheck = audioplayer(BPFData,Fs)
play (BPFcheck)
5. %5
Fs=11025;
[B,A] = fir1(15,[2000 3000]/(Fs/2),'stop')
zplane(B,A);
[a,n] = impz (B,A);
stem(n,a,'r')
title('Impulse Response');
xlabel('n(samples)');
ylabel('Amplitude');
[h,g] = freqz(B,A);
plot (g * Fs/(2*pi),abs(h),'r')
title ('Magnitude Response');
xlabel('Frequency(Hz)');

ylabel('Magnitude');
%6
Fs=11025;
SBFData = filter(B,A,y);
SBFMag = fft(SBFData);
plot(abs(LPFMag(1:40000)),'r')
title('FFT audio file under Low Pass');
xlabel('Frequency(HZ)');
ylabel('Magnitude');
SBFcheck = audioplayer(SBFData,Fs)
play (SBFcheck)

You might also like