0% found this document useful (0 votes)
28 views2 pages

DSP Lab 5 Implementing Filters

This document discusses implementing a low-pass FIR filter in Matlab and on a DSK board. It includes: 1) Observations of the frequency response of a filter when sweeping frequency, noting the amplitude falls to zero at the cut-off frequency. 2) Code for a 16-order low-pass FIR filter with a 5 kHz cut-off frequency and 48 kHz sampling rate, using dot product and filter coefficient generation in Matlab. 3) Changing the sampling rate to 96 kHz extends the cut-off frequency to 18 kHz while keeping the filter coefficients unchanged.

Uploaded by

Ali Ahmad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

DSP Lab 5 Implementing Filters

This document discusses implementing a low-pass FIR filter in Matlab and on a DSK board. It includes: 1) Observations of the frequency response of a filter when sweeping frequency, noting the amplitude falls to zero at the cut-off frequency. 2) Code for a 16-order low-pass FIR filter with a 5 kHz cut-off frequency and 48 kHz sampling rate, using dot product and filter coefficient generation in Matlab. 3) Changing the sampling rate to 96 kHz extends the cut-off frequency to 18 kHz while keeping the filter coefficients unchanged.

Uploaded by

Ali Ahmad
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

DSP Lab 5 Implementing Filters

1. How will you explain your observation in step 4? You may get help with Matlab to justify your answer. Observations When we sweep frequency from 0 to 2 khz the frequency of the signal increases and the amplitude of the signal decreases and it falls to zero at 2 khz. Furthurmore,when we sweep the frequency from 2 khz to 3 khz , the amplitude of the signal increasses and then it again decreases and falls to zero when the frequency is 4 khz. 2. Write a program A5.pjt to implement a 16-order low-pass FIR filter with cut-off frequency at 5 kHz. Generate filter coefficients using fir1 command in Matlab. Set sampling frequency 48 kHz in this program. float dotp(float *, float *,int); //dot product function #include <dsk6713.h> #include <DSK6713_AIC23.h> Uint32 fs=DSK6713_AIC23_FREQ_48KHZ; float h[17]={0,-.001,0.01,-.001,0.022,0.072,0.135,0.189,0.2097,0.185,0.135,0.075,0.025,-0.003,-0.01,0.005,-0.003}; float x[17]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; void c_int11(void) //ISR defined in .cdb { short out_data = 0; short in1; Uint32 in; int i; in = input_sample(); in1=(short)in; for (i=0;i<16;i++) x[i] = x[i+1]; x[16] = in1; x[16] = (float)in1;

out_data = dotp(h, x, 17); output_sample(out_data); return; } float dotp(float *a, float *b, int ncount) //dot product function { float sum = 0; //init sum variable int i; for (i = 0; i < ncount; i++) sum += a[i] * b[i]; //sum of products return(sum); //return sum as result } void main() { comm_intr(); while(1); } Observations When we sweep frequency from 3 khz,the signal amplitude decreases and it reaches to zero at 8 khz. 3. . What will happen if you change sampling frequency to 96 kHz in the program A5.pjt, keeping other parameters unchanged? Observations When we change the sampling frequency to 96khz ,and sweep the frequecy from 3 khz,it can be clearly observed on the oscilloscope that the amplitude of the signal decreases and falls to zero at 18 khz. If we see the impulse response of the filter in matlab , the amplitude of the samples of the filter increases by changing the samplling frequecny to 96khz.

//init codec,DSK, MCBSP //infinite loop

You might also like