Professional Documents
Culture Documents
DSP Assignment
DSP Assignment
ASSIGNMENT ( 15% )
Name Student ID Majoring
To be filled by lecturer:
filename = ‘original.wav’;
[y,Fs] = audioread(‘original.wav’);
sound(y,Fs);
plot(y);
x-axis : Frequency ( Hz )
y-axis : magnitude ( dB )
Noisy Waveform
filename = ‘original.wav’;
[y,Fs] = audioread(‘original.wav’);
sound(y,Fs);
plot(y);
x-axis : Frequency ( Hz )
y-axis : magnitude ( dB )
Filter design specification
As shown in diagram below, we can see the amplitude versus samples graph for time domain and
magnitude versus normalised frequency graph for frequency domain.
Filter Specification
Filter Specification
%sound(x,fs);
[x, fs] = audioread ('noisy.wav');
x = x(:,1);
N = length(x);
t = (0:N-1)/fs;
audiosec = N/fs;
%sound(x1,1);
[x1, fs1] = audioread ('original.wav');
x1 = x1(:,1);
N1 = length(x1);
t1 = (0:N1-1)/fs1;
audiosec1 = N1/fs1;
%Plot graph
%subplot(2,1,1); % (row,column,position)
plot(t,x);
grid on;
xlim ([0, 8]);
xlabel('time (s)');
ylabel ('amplitude');
title('Noisy Signal');
hold on
%%subplot(2,1,2);
plot(t1,x1);
grid on;
xlabel('time (s)');
ylabel ('amplitude');
title('Original Signal');
ylim([-0.5,0.5]);
xlim([0,8]);
subplot(2,1,2);
plot(f,abs(originalSignal));
title ('original signal in frequency');
xlabel ('freq (Hz)'); ylabel ('magnitude');
%Design Filter
filterDesigner;
%fpass=1750 fstop=2000 fs=8000
FilteredSignal = filter(Hd, x);
FilteredSignalTransform = fft(FilteredSignal);
figure
plot(t,FilteredSignal);
hold on;
plot(t1,x1);
grid on;
ylim([-0.5,0.5]);
xlim([0,8]);
figure
subplot(2,1,1);
plot(f,abs(Y));
title ('Noisy signal in frequency');
xlabel ('freq (Hz)'); ylabel ('magnitude');
subplot(2,1,2);
plot(f,abs(FilteredSignalTransform));
title ('Filtered signal in frequency');
xlabel ('freq (Hz)'); ylabel ('magnitude');
ylim([0,400]);
sound(FilteredSignal,fs);
Figure 1: Original Waveform and Noise waveform in time domain
Figure 2: Original Waveform and Noise waveform in time domain after using FIR
Figure 3: Original Waveform and Noise waveform in time domain after using IIR
Discussion
The blue waveforms are known as noise signals and the orange waveform is the original signals.
In figure 1 the noise signals is beyond the original signal and it creates distortion in the sound. In
figure 2, the noise signal have been reduced after using finite impulse response. As for figure 3, the
noise signal is being reduced even more better compare to figure 2 after using infinite impulse
response.
Figure 4: Original Waveform and Noise waveform in frequency domain
Figure 5: Original Waveform and Noise waveform in frequency domain after using FIR
Figure 6: Original Waveform and Noise waveform in frequency domain after using IIR
Discussion
In figure 4, approximately from 2kHz to 6kHz there is additional waveform in noise signal
compare to original signal. Using FIR, the additional waveform in noise signal will be filtered as
shown in figure 5 and figure 6. Comparing original signal and filtered signal, the waveform from
2kHz to 6kHz is removed slightly indicates that some original signal has been deleted after filter.
Conclusion
After doing this assignment both of us learnt the importance of finite impulse response(FIR) and
infinite impulse response(IIR). Removing noise from original signal is an essential role of filter.
We have applied the theory and design a filter using matlab and analog filter wizard.We are happy
doing this assignment as we learnt several technical skills like using matlab in simpler way.
Reference
1. Youtube link - https://www.youtube.com/watch?v=VFt3UVw7VrE