I have to do some exercises in a Digital Signal Processing course and I have some problems.
I have a given file (signal.wav name the signal x(n)
) with some noise added and iIam asked to find some information from it. The noise added is η(n) = sin8000πn
. So the signal I am processing is s(n) = x(n) + η(n)
In order to remove the noise, I apply a low-pass butterworth filter with order = 2
and cutoff frequency = 2000hz.
I want to find the transfer function H(s)
from the filter and the H(z)
function. Well I know that I have to apply bilinear transformation but iIdont know how to do it with MATLAB.
Can anyone help me solve this?
Here is my code
[y, fs, nbits] = wavread('signal.wav');
% Playing the file
disp('-> Playing at the original sample rate...');
sound(y, fs);
fprintf('------------------------------------------\n');
% Sampling frequency
fprintf('-> Sample frequency is: %f.\n', fs);
% Print the min and max values of the audio data.
fprintf('-> The maximum data value is %f.\n', max(y));
fprintf('-> The minimum data value is %f.\n', min(y));
fprintf('------------------------------------------\n');
order = 2;
sampling_freq = fs;
cut_off_freq = 2000;
[butter_a, butter_b] = butter(order,cut_off_freq/(sampling_freq/2));
%[butter_a, butter_b] = butter(order,cut_off_freq/(sampling_freq));
subplot(211), plot(y);
subplot(212), plot(filter(butter_a,butter_b,y));
sound(filter(butter_a,butter_b,y),fs);