India's Largest Online Store. Best Prices . Discount Free Shipping · Easy Returns · Cash On Delivery

Thursday 22 January 2015

Digital Signal Processing (DSP) Butterworth HighPass Filter Using MATLAB



This mini project introduces a new class of IIR digital filters.That unifies the classical digital Butterworth High Pass filter. New closed form expressions are provided, and a straight forward design technique is described. The new IIR digital filters have non linear phase & more zeros than poles (away from the origin) and their (monotonic) square magnitude frequency responses are maximally flat w= 0 and at w =pi. This technique also permits continuous variation of the cut-off frequency. 
We can also use Digital signal processor DSP Microcontroller like DSPPic from Microchip technology,TMS320C5000 series DSP controller from TI Texas Instruments etc.
The Butterworth High Pass Filter attenuates all frequencies below cut-off frequency and passes all frequencies above cut-off frequency.


Butterworth_High_Pass_Filter_DSP_MATLAB www.beprojectidea.blogspot.com
Butterworth_High_Pass_Filter_DSP_MATLAB www.beprojectidea.blogspot.com

Aim: 

Design Butterworth Highpass filter using MATLAB.

Theory: 

This introduction makes the link with analog filters and associated frequency transformation. The digital filters are simply computed from the analog transfer functions using the bi linear transform.

A key element in processing digital signals is the filter. Filters perform direct Manipulations on the spectra of signals. To completely describe digital filters, three basic elements (or building blocks) are needed: an adder, a multiplier, and a delay element. The adder has two inputs and one output, and it simply adds the two inputs together. The multiplier is a gain element, and it multiplies the input signal by a constant. The delay element delays the incoming signal by one sample. Digital filters can be implemented using either a block diagram or a signal flow graph. Figure 1 shows the three basic elements in block diagram form, and Figure 2 shows them in signal flow graph form.
 
 
Block Diagram of Filter Element(Digital Signal Processing (DSP) Butterworth HighPass Filter ) www.beprojectidea.blogspot.com
Block Diagram of Butterworth High pass filter using MATLAB Element 
Signal Flow Graph of Filter Elements (Digital Signal Processing (DSP) Butterworth HighPass Filter ) www.beprojectidea.blogspot.com
Signal Flow Graph of Filter Elements (Digital Signal Processing (DSP) Butterworth HighPass Filter )

With the basic building blocks at hand, the two different filter structures can easily be implemented. These two structures are Infinite Impulse Response (IIR) and Finite Impulse Response (FIR), depending on the form of the system’s response to a unit pulse input. IIR filters are commonly implemented using a feedback (recursive) structure; while FIR filters usually require no feedback (non-recursive).




In the design of IIR filters, a commonly used approach is called the bilinear transformation. This design begins with the transfer function of an analog filter, and then performs a mapping from the s-domain to the z-domain. Using differential equations, it can be shown (Proakis 677) that the mapping from the s-plane to the z-plane is

mapping from the s-plane to the z-plane  (Digital Signal Processing (DSP) Butterworth HighPass Filter ) www.beprojectidea.blogspot.com
mapping from the s-plane to the z-plane

This mapping results in a general form for an IIR filter with an arbitrary number of poles and zeros. The system response and the difference equation for this filter are as follows:

system response and the difference equation for an IIR filter (Digital Signal Processing (DSP) Butterworth HighPass Filter ) www.beprojectidea.blogspot.com
system response and the difference equation
for an IIR filter

This system response can be easily realized using a signal flow graph.


Signal Flow Graph of IIR Filter  (Digital Signal Processing (DSP) Butterworth HighPass Filter ) www.beprojectidea.blogspot.com
Signal Flow Graph of IIR Filter


The choices for the digital filter follow the two main categories of digital linear time-invariant systems.  The first category is called Finite Impulse Response (FIR) and the output of this system only depends on current and past input samples.
The z variable representation of this system is
However, FIR filters require an order N of the system that is often very high.
The second category of digital LTI systems is called Infinite Impulse Response (IIR).  In this case, the output of the system depends on current and past input samples, but also on past output samples.  This leads to recursive type of algorithms. 
The z variable representation of this system is
The transfer function in the variable z of a digital filter can be computed from the transfer function in the variable s of an analog filter by using what is called the bilinear transform given below.

For instance, consider the first order analog low pass filter H(s).  The equivalent first order digital low pass filter H(z)is given by replacing s in the analog transfer function by the bilinear transform expression.  

 
The transfer function can be implemented in many ways.  For example one can find the recurrence formula describing the system.

And
In the time domain this gives
The recurrence formula of the digital filter is then given by

You could implement this code yourself or use the MATLAB function called filter. 
a0 = 1 + 2/(w0*Ts);
a1 = 1 - 2/(w0*Ts);
b0 = 1;
b1 = 1;
A = [a0 a1];
B = [b0 b1];
yt = filter(B, A, xt);
Where xt has the samples of the input signal using sampling rate Fs used in the bilinear transform and yt will have the samples of the output signal.

MATLAB PROGRAMME CODE: 



clc;
close all;clear all;
format long
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
wp=input('enter the passband freq.');
ws=input('enter the stopband freq.');
fs=input('enter the sampling freq.');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=buttord(w1,w2,rp,rs);
[b,a]=butter(n,wn,'high');
w=0:.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(211);plot(om/pi,m);
ylabel('gain in db');xlabel('freq.');
subplot(212);plot(om/pi,an);
ylabel('phase');xlabel('freq.');

Output:

INPUT  FILTER  PARAMETERS  :


The passband ripple           : 0.5 db
The stopband ripple           : 50 db
The passband frequency   : 1200 Hz
The stopband frequency   : 2400 Hz 
The sampling frequency     : 10000 Hz

CONCLUSION :


                From the Mat Lab simulation program for Butterworth High Pass Filter we conclude that It attenuates all frequencies below specified cut-off frequency and passes all frequencies above specified cut-off frequency.