Hello,
I have tried to implement the basic example presented in the document in CCS v5.5.
Here I have used DSP library to implement FIR Filtering (DSPF_sp_fir_gen).
When I compare my results from the documentation, my results are marginally different.
I tried many cases but still unable to get the results in the documentation.
Here the code.
#include"stdio.h"
#include"DSPF_sp_fir_gen.h"
#define BUFFERLENGTH 240
#pragma DATA_ALIGN(x,8)
#pragma DATA_ALIGN(h,8)
#pragma DATA_ALIGN(y,8)
float h[BUFFERLENGTH],x[BUFFERLENGTH], y[200];
#define PI 3.141592653589
int main(void) {
int nh,nr;
int i,Fs=44100,F1=370,F2=10500;
float temp;
FILE *fp1;
fp1 = fopen("filterCoeff.txt","r+");
/* Input initialization of input as well as FilterCoeff*/
for (i=0; i<BUFFERLENGTH; i++)
{
x[i]= (sin(2*PI*F1*i/Fs) + sin(2*PI*F2*i/Fs));
h[i]=0.0;
}
/*FIlter Coeff from matlab FDA tool according to Documentation (Fs =44100Hz, Fc=10000Hz, LPF, Window,Kaiser,beta =0.5) */
/* The filter coeffiects are taken from the text file(matlab coeffients) and have been varified before question posting*/
while(i<BUFFERLENGTH)
{
fscanf(fp1,"%lf\n",&temp);
h[BUFFERLENGTH-i-1] = (float)temp;
i++;
}
fclose(fp1);
nh = BUFFERLENGTH;
nr = 200;
DSPF_sp_fir_gen(x,h,y,nh,nr);
return 0;
}
RESULTS
Result from Document
My code result.
One can clearly observe that the results are different and F2 is not completely filtered from the input signal in my case.
Can anyone please help me with the solution or an answer.
please guide me if there is an error in coding.
Thanks for reading
Nageshwar Singh