American International University-Bangladesh (AIUB) Faculty of Engineering (EEE)
American International University-Bangladesh (AIUB) Faculty of Engineering (EEE)
P.05.3.P5 Create relevant resources for complex engineering problems using modern engineering tools.
Marking Rubrics (to be filled by Faculty)
Proficient Good Acceptable Unacceptable Secured
Category
[5-4] [3] [2] [1] Marks
Algorithm of the Algorithm of the Algorithm of the Algorithm of the issue
issue/problem to be issue/problem to be issue/problem to be /problem to be
considered critically is stated considered critically is considered critically is considered critically is stated
clearly and described stated, described, and stated, but description leaves without clarification or
Algorithm/Logic comprehensively, delivering clarified so that some terms undefined, description.
relevant information understanding is not ambiguities unexplored,
necessary for full seriously impeded by boundaries undetermined,
understanding. omissions.
Syntax of the programming Syntax of the programming Syntax of the programming Syntax of the programming
Coding/ Syntax language is most efficient language is correct and no language is 60% correct. language is erroneous.
and shortest. error is found.
Detail analysis of the Justified analysis is Relevant analysis is Analysis is irrelevant to the
problem solution is presented. described. problem solution.
Analysis presented. Correct
explanation is expected with
proper reference.
The whole report is The report is thorough, Information lacks depth. Vague, unclear.
Organization of exceptionally well-organized relevant and accurate Accurate but inadequate or Insufficient or irrelevant
the Report and very easy to understand. information to some extent. repetitive at times. information.
Total Marks
Comments:
(Out of 20 ):
Instructions:
Use the following code to record your voice and store it in MATLAB:
Problem 1: Use your own voice to record an audio and save the recorded sound as an audio file,
load it into MATLAB by following the instruction given above. Store the recording into the
more usual vector of audio and show a time-domain plot of your recorded sound sample.
Problem 2: Show the frequency domain response of the data by using the function freqz() in
MATLAB by choosing the range of ω from 0 to π.
Problem 3: Now add a white Gaussian noise to your recorded audio sample by using the
function awgn(input signal, SNR). Use two different values for SNR (in dB) which indicates the
quality of the channel characteristics, i.e. one good channel and one bad channel. Plot the noisy
signal for two different values of SNR and observe the outputs. Which output is better? Justify
your answer.
Problem 4: Now design three different filters; LPF, HPF and BPF to pass this noisy signal and
remove the noise. Choose the cutoff range from the frequency response curve of your voice
signal. Plot the frequency response curve of all your filters and the filtered signals. Which filter
output is better for your sound processing system?
Page - 2
DSP Lab
2 w=0:pi/200:pi;
[h,w]=freqz(speech,1,w);
figure(2)
subplot(212)
plot(w,abs(h))
title('Frequency Domain')
3 noiseworse=awgn(speech,30);
noisebetter=awgn(speech,70);
subplot(211)
plot(noiseworse)
title('Worse Channel')
figure(3)
subplot(212)
plot(noisebetter)
title('Better Channel')
Page - 3
DSP Lab
4. F1=7000;
F2=800;
F3=1000;
r1=1;
r2=50;
p=1-10.^(-r1/20);
q=10.^(-r2/20);
fp=[F2 F3];
mg=[1 0];
de=[p q];
[A21,wA21,beta,~]=kaiserord(fp,mg,
de,F1);
lowpassfilter=fir1(A21,wA21,
kaiser(A21+1,beta));
[h,w]=freqz(lowpassfilter,1);
figure(4);
plot(w*7000*0.5/pi,abs(h));
title('FIR low pass filter');
xlabel('frequency')
ylabel('magnitude')
grid on;
%high pass
F2=3000;
F3=2000;
mg=[0 1];
[A23,wA23,beta,~]=kaiserord(fp,mg,
de,F1);
highpassfilter=fir1(A23,wA23,'high',
kaiser(A23+1,beta));
[h,w]=freqz(highpassfilter,1);
figure(5);
plot(w*10000*0.5/pi,abs(h));
title('FIR high pass filter');
xlabel('frequency')
ylabel('magnitude')
grid on;
%Bandpass filter
F =[1000 1300 2210 2410 ]; % cutoff
mg=[0 1 0];
devs=[0.01 0.05 0.01];
[n,wA23,beta,ftype]=kaiserord(F,mg,devs,
F1);
n=n+rem(n,2);
bandpassfilter=fir1(n,wA23,'bandpass',
Kaiser
(n+1,beta),'noscale');
[h,w]=freqz(bandpassfilter,1,1024,F1);
figure(6);
plot(w*10000*0.5/pi,abs(h));
title('FIR band pass filter');
xlabel('frequency')
ylabel('magnitude')
grid on;
%signal spectrum using lowpass filter
SSULF=fftfilt(lowpassfilter,noisebetter);
Page - 4
DSP Lab
%signal spectrum using highpass filter
SSUHF=fftfilt(highpassfilter,noisebetter);
%signal spectrum using bandpass filter
SSUBF=fftfilt(bandpassfilter,noisebetter);
figure(7);
subplot(411),
plot(noisebetter)
title('signal spectrum before signal')
xlabel('frequency'),ylabel('magnitude' )
grid on;
subplot(412),plot(SSULF),title('signal
spectrum after signal bylowpass'),
xlabel('frequency'),ylabel('magnitude'),
grid on;
subplot(413),plot(SSUHF),
title('signalspectrum after signal
highpass'),
xlabel('frequency'),ylabel('magnitude'),
grid on;
subplot(414),plot(SSUBF),
title('signal spectrum after signal
bandpass'),
xlabel('frequency'),ylabel('magnitude'),
grid on;
%......................
%signal spectrum using lowpass filter
SSULF=fftfilt(lowpassfilter,noiseworse);
%signal spectrum using highpass filter
SSUHF=fftfilt(highpassfilter,noiseworse);
%signal spectrum using bandpass filter
SSUBF=fftfilt(bandpassfilter,noiseworse);
figure(8);
subplot(411),
plot(noisebetter)
title('signal spectrum before signal')
xlabel('frequency'),ylabel('magnitude')
grid on;
subplot(412),plot(SSULF),
title('signal spectrum after signal by
lowpass'),
xlabel('frequency'),ylabel('magnitude'),
grid on;
subplot(413),plot(SSUHF),
title('signal spectrum after signal
highpass'),
xlabel('frequency'),ylabel('magnitude'),
grid on;
subplot(414),plot(SSUBF),
title('signal spectrum after signal
bandpass'),
xlabel('frequency'),ylabel('magnitude'),
grid on;
Page - 5
DSP Lab
Comments: It can be said that the actual result was found from those signal spectrum output. From those three
filters, Low Pass Filter (LPF) gave us better signal than High Pass Filter(HPF) and Band Pass Filter(BPF).Here,
I used FIR filter as ‘Kaiser’ for more accurate result .So, Low Pass Filter(LPF) was much better for my sound
processing system.
Page - 6