## Introduction

This paper is about signal processing in Matlab. IEEE Signal Processing Society organize a competition among universities all around the world. Beside, this year, the goal of the competition was to track the beat of a song in real-time. You are supposed to implement a simple tempo estimation algorithm. The details about Signal Processing are given in the problems.

## Problem 1 Signal Processing

Sampling frequency is 44100 Hz. Design a digital IIR Butterworth filter

• Pass-band edge frequency is 200 Hz. The ripple at pass-band should be -1 dB.

• Stop-band edge frequency is 400 Hz. The minimum attenuation at stop-band is -40 dB.

Manipulate the Matlab Code at the bottom of the page to design your filter. Plot the resulting magnitude response in two

subplots. x axes are frequency in terms of Hertz, y axes are magnitudes in terms of decibels. • For the first subplot, x axis range is [0 − 22050] Hz.

• For the second subplot, x axis range is [0 − 600] Hz (Hint: xlim command).

Questions:

• The final Matlab code,

• Filter coefficients ai and bis,

• Transfer function H(z),

• Magnitude response plots (two subplots),

• Pole-zero map of the filter (Hint: pzmap command)

Firstly, Matlab Code:

Fs=44100;

Ts=1/Fs;

Fn=Fs/2;

wp=200/Fn;

ws=400/Fn;

Rp=1;

Rs=40;

a(0) = 1

a(1) = -7.83573

a(2) = 26.8636

a(3) = -52.6303

a(4) = 64.4488

a(5) = -50.5127,

a(6) = 24.7452

a(7) = -6.9274

a(8) = 0.848502

b(0) = 3.98943e-15

b(1) = 3.19154e-14

b(2) = 1.11704e-13

b(3) = 2.23408e-13

b(4) = 2.7926e-13

b(5) = 2.23408e-13

b(6) = 1.11704e-13

b(7) = 3.19154e-14

b(8) = 3.98943e-15

Question 1 :

[N,wc]=buttord(wp,ws,Rp,Rs,’s’); [z,p,k]=butter(N,wc,’s’); Hbanalog=zpk(z,p,k) [b,a]=butter(N,wc);

Hbdigital=tf(b,a,Ts)

[h,w] = freqz(b,a);

dB = mag2db(abs(h));

figure(1)

subplot(2,1,1)

plot((w/pi)*(Fs/2),dB)

xlabel(‘\omega / \pi’)

ylabel(‘Magnitude (dB)’)

xlim([0 22050])

grid;

subplot(2,1,2)

plot((w/pi)*(Fs/2),dB)

xlabel(‘\omega / \pi’)

ylabel(‘Magnitude (dB)’)

xlim([0 600])

grid;

for k = 1:N+1

fprintf(‘a(%d) = %8.6g, \t b(%d) = %8.6g \n’, k-1, a(k),k-1, b(k));

end

figure(2)

pzmap(Hbdigital)

grid;

The transfer function H(z)

1.1728e-16

—————————————————————————————————————-

(s^2 + 0.02001s + 0.0001041) (s^2 + 0.01696s + 0.0001041) (s^2 + 0.01134s + 0.0001041) (s^2 + 0.00398s + 0.0001041)

The magnitude response plots

Pole-zero map of the filter

## Problem 2 of Signal Processing

In this paragraph, use the filter designed in Problem 1 to filter the input signal. Use the filtfilt command to avoid delay. Plot the input and output signals.

Questions:

• The final Matlab code,

• Input and output signals in two subplots,

• The input and output FFT plots in two subplots.

Firstly, Matlab Code:

Fs=44100;

Ts=1/Fs;y=filtfilt(b,a,x);

yf=fft(y);

xf=fft(x);N = 4411;

dF = Fs/N;

f =0:dF:Fs-dF;

subplot(2,2,1)

plot(t,x);

xlabel(‘Time’);

ylabel(‘Magnitude’);

title(‘Input’);

grid;subplot(2,2,3)

plot(t,y);

xlabel(‘Time’);

ylabel(‘Magnitude’);

title(‘Output’);

ylim([-15 10])

grid;

subplot(2,2,2)

plot(f,abs(xf)/N);

xlabel(‘Frequency (in hertz)’);

ylabel(‘Magnitude’);

title(‘Input’);

grid;subplot(2,2,4)

plot(f,abs(yf)/N);

xlabel(‘Frequency (in hertz)’);

ylabel(‘Magnitude’);

title(‘Output’);

grid;

The input and output signals