Breaking

Be Strong Let's Try!

Sunday, 5 September 2021

Filter Design using FDA Toolbox | Digital Signal Processing

Objective:

Objective of this topic is to Design filter and to apply different type of IIR filters on audio signal.

TASK:

Design a discrete time low pass filter by applying the appropriate type of following filters:

1.      Butterworth

2.      Chebyshev Type I

3.      Elliptic

The specifications of the desired filters are:-

a.



 

b



.

 

1.      Design all three low pass filters on above specifications observe poles, zeros and magnitude response and comment which one is better and why?

2.      Now Add a noise using awgn command in audio signal and apply all the 6 filters to remove noise, listen, observe and write down which filter has performed well and why?

 

Now Lets see the practical work using the MATLAB:

Part (A)

                                                                 1. Butterworth:

 

Filter Design using FDA Toolbox
Filter Design using FDA Toolbox

2. Chebyshev Type 1:
Filter Design using FDA Toolbox


Filter Design using FDA Toolbox


                                                                      3. Elliptic:

Filter Design using FDA Toolbox


Filter Design using FDA Toolbox

                     
Part (B)

                                                                 1. Butterworth:


Filter Design using FDA Toolbox

Filter Design using FDA Toolbox

                                                     2. Chebyshev Type 1:

Filter Design using FDA Toolbox


Filter Design using FDA Toolbox 
                                                              3. Elliptic:

Filter Design using FDA Toolbox

Filter Design using FDA Toolbox


Observations:
Part (A)
All the three filters are designed for the same specifications. The Butterworth filter was of order 10 with all the poles placed on imaginary axis. There are no ripples in the passband neither the stop band. The Chebyshev type 1 filter showed a decrease in the order and it was reduced to 6 with the change in position of the poles. However, no ripples were observed in the pass band due to the specifications. The elliptic filter showed extremely good response for the low pass filter reducing the order to 4. The stop band ripples are clearly visible but the pass band ripples are not. It is computationally fast as compared to the other two filters. Hence the elliptic filter is the best among these three.  

Part (B)
Just like part a, all the three filters are designed for the another set of specifications. The Butterworth filter was of order 5 with all the poles placed on the right half in a curvy shape. There are no ripples in the passband neither the stop band. The Chebyshev type 1 filter showed a decrease in the order and it was reduced to 3 with the change in position of the poles. All the 3 poles are still on the right half, vertically. However, no ripples were observed in the pass band due to the specifications. The elliptic filter showed extremely good response for the low pass filter reducing the order to 2. The stop band ripples are clearly visible due to motion of the zeros on the circle, producing the dips/ripples. But the pass band ripples are not there. It is computationally fast as compared to the other two filters as it has the smallest number of coefficients and require less computations. Hence the elliptic filter is the best among these three.  

02:

Code:

rec = audiorecorder(8000,8,1);  %create a recorder object

record(rec,3);                  %record audio for 3 seconds 

x = getaudiodata(rec);          %get the auio data array in x

y = awgn(x,10,'measured');      %adding gaussian noise to input signal x);                                   

T = 1/Fs;                       %increment in time axis  

 

%applying filters to the noisy audio

y1 = filter(Ba,y);              %Part a : Butterworth

y2 = filter(Ca,y);              %Part a : Chebyshev Type 1

y3 = filter(Ea,y);              %Part a : Elliptic

y4 = filter(Bb,y);              %Part b : Butterworth

y5 = filter(Cb,y);              %Part b : Chebyshev Type 1

y6 = filter(Eb,y);              %Part b : Elliptic

sound(y,Fs)

 

%plot original and noisy signals in time and frequency domain

figure

subplot(2,2,1)

tx = 0:T:(length(x)*T)-T;

plot(tx,x)

title('Original Signal in Time Domain')

xlabel('Time')

ylabel('Amplitude')

subplot(2,2,2)

FFTx = abs(fft(x));

fx = (0:length(FFTx)-1)*Fs/length(FFTx);

plot(fx,FFTx,'r')

title('Original Signal in Frequency Domain')

xlabel('Frequency')

ylabel('Magnitude')

subplot(2,2,3)

t = 0:T:(length(y)*T)-T;

plot(t,y)

title('Noisy Signal in Time Domain')

xlabel('Time')

ylabel('Amplitude')

subplot(2,2,4)

FFT = abs(fft(y));

f = (0:length(FFT)-1)*Fs/length(FFT);

plot(f,FFT,'r')

title('Noisy Signal in Frequency Domain')

xlabel('Frequency')

ylabel('Magnitude')

 

%plot outputs of all three filters of part a in time and frequency domain

figure

subplot(3,2,1)

t1 = 0:T:(length(y1)*T)-T;

plot(t1,y1)

title('Butterworth Filter')

xlabel('Time')

ylabel('Amplitude')

subplot(3,2,2)

FFT1 = abs(fft(y1));

f1 = (0:length(FFT1)-1)*Fs/length(FFT1);

plot(f1,FFT1,'r')

title('Butterworth Filter')

xlabel('Frequency')

ylabel('Magnitude')

subplot(3,2,3)

t2 = 0:T:(length(y2)*T)-T;

plot(t2,y2)

title('Chebyshev Type 1 Filter')

xlabel('Time')

ylabel('Amplitude')

subplot(3,2,4)

FFT2 = abs(fft(y2));

f2 = (0:length(FFT2)-1)*Fs/length(FFT2);

plot(f2,FFT2,'r')

title('Chebyshev Type 1 Filter')

xlabel('Frequency')

ylabel('Magnitude')

subplot(3,2,5)

t3 = 0:T:(length(y3)*T)-T;

plot(t3,y3)

title('Elliptic Filter')

xlabel('Time')

ylabel('Amplitude')

subplot(3,2,6)

FFT3 = abs(fft(y3));

f3 = (0:length(FFT3)-1)*Fs/length(FFT3);

plot(f3,FFT3,'r')

title('Elliptic Filter')

xlabel('Frequency')

ylabel('Magnitude')

 

%plot outputs of all three filters of part a in time and frequency domain

figure

subplot(3,2,1)

t4 = 0:T:(length(y4)*T)-T;

plot(t4,y4)

title('Butterworth Filter')

xlabel('Time')

ylabel('Amplitude')

subplot(3,2,2)

FFT4 = abs(fft(y4));

f4 = (0:length(FFT4)-1)*Fs/length(FFT4);

plot(f4,FFT4,'r')

title('Butterworth Filter')

xlabel('Frequency')

ylabel('Magnitude')

subplot(3,2,3)

t5 = 0:T:(length(y5)*T)-T;

plot(t5,y5)

title('Chebyshev Type 1 Filter')

xlabel('Time')

ylabel('Amplitude')

subplot(3,2,4)

FFT5 = abs(fft(y5));

f5 = (0:length(FFT5)-1)*Fs/length(FFT5);

plot(f5,FFT5,'r')

title('Chebyshev Type 1 Filter')

xlabel('Frequency')

ylabel('Magnitude')

subplot(3,2,5)

t6 = 0:T:(length(y6)*T)-T;

plot(t6,y6)

title('Elliptic Filter')

xlabel('Time')

ylabel('Amplitude')

subplot(3,2,6)

FFT6 = abs(fft(y6));

f6 = (0:length(FFT6)-1)*Fs/length(FFT6);

plot(f6,FFT6,'r')

title('Elliptic Filter')

xlabel('Frequency')

ylabel('Magnitude')

Output:

Original and noisy signals in time and frequency domain

Filter Design using FDA Toolbox

Outputs of Filters designed in Part A:

Filter Design using FDA Toolbox

Outputs of Filters designed in Part B:

Filter Design using FDA Toolbox

Observations:

All the Outputs of the filters designed in part a still had a hollow noise in the background. Elliptic was better than Chebyshev type 1 and it was better than Butterworth.

Filters in part b produced comparatively good results as compared to those in part a. In Butterworth, the noisy effect was still there but it was quite diminished. Same was the case with the Chebyshev where the noise was very minute but also the actual audio signal got diminished. Overall the result was quite good considering the reduction of noise to a large extent.  In case of Elliptic filter, the output had some noise but the audio was quite loud and clear. But it was not able to remove the noise completely too. Considering the noise reduction aspect, Chebyshev Type 1 in part b produced the best results. This is as the pass band was quite small and it attenuated the higher frequency very smoothly. However, elliptic in part b worked great in bringing back the original audio signal as the amplitude of the lower frequencies did not attenuate.            

 

 

 

 


 

No comments:

Post a Comment

Pages