Google Search

Thursday, November 10, 2011

FIR FILTER DSP using C program


FIR FILTER
AIM: -                                               
To design and implement a low pass FIR filter using windowing technique.
APPARATUS: -
1.      TMS320C5416 DSK.
2.      USB Cable.
3.      Power Cord
4.      5V Adapter.

THEORY: -
A Finite Impulse Response (FIR) filter is a discrete linear time-invariant system whose output is based on the weighted summation of a finite number of past inputs. An FIR transversal filter structure can be obtained directly from the equation for discrete-time convolution.
                                           (1)
In this equation, x(k) and y(n) represent the input to and output from the filter at time n.  h(n-k) is the transversal filter coefficients at time n. These coefficients are generated by using FDS (Filter Design Software or Digital filter design package).


Windows:  

#include <stdio.h>
#include <math.h>
#define pi 3.1415
int N,n;
float h[64];
void main()
{
  printf("enter the number of samples\n");
  scanf("%d",&N);
  for(n=0;n<(N-1);n++)
  {
   h[n]=0.0;
   h[n]= 0.42+0.5*cos(2*pi*n/(N-1))+0.08*cos(4*pi*n/(N-1));
  printf("h[%d]=%f\n",n,h[n]);
  }
  
}


RESULT:




PROGRAM: -

#include <stdio.h>
#include <math.h>
#define pi 3.1415
int N,n;
float h[64];
void main()
{
  printf("enter the number of samples\n");
  scanf("%d",&N);
  for(n=0;n<(N-1);n++)
  {
   h[n]=0.0;
   h[n]=1-(4*n/(float)(n-1)) ;
  printf("h[%d]=%f\n",n,h[n]);
  }
  
}


Wave form:-



0 comments:

Post a Comment