Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Electronic Equipment > Digital Signal Processing (DSP) > Re: 5 Stages CI...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 13233 of 14259
Post > Topic >>

Re: 5 Stages CIC Filter Matlab Simulation Problem

by Tony <tonyjiang86@[EMAIL PROTECTED] > Jun 27, 2008 at 01:57 AM

On Jun 27, 9:39=A0am, tonyjian...@[EMAIL PROTECTED]
 wrote:
> I implemented the matlab simulation model according to hardware
> architecture.The impulse response is ok when the impulse length is
> short.But when I increase the length of impulse stimulus, I found
> increasing spurs. I don't know whether this is caused by the
> instability of the filter or some other reasons. Attached is the
> matlab code,and at the end of code I added the matlab internal
> function mfilt.cicdecim for comparison.
>
> %Filter Stimulus
> %data_in =3Dsin((1:2^15)*pi/2^10);
> data_in =3D[1 zeros(1,4*6000-1)];
>
> %Filter Parameters
> R=3D 4;%decimation factor
> M=3D1;%differential delay
> N=3D5;%cascaded numbers of section
>
> %Integrator Section Registers Initialization
> intg_reg1(1) =3D data_in(1);
> intg_reg1_d(1) =3D0;
> intg_reg2(1) =3D 0;
> intg_reg2_d(1) =3D0;
> intg_reg3(1) =3D 0;
> intg_reg3_d(1) =3D0;
> intg_reg4(1) =3D 0;
> intg_reg4_d(1) =3D0;
> intg_reg5(1) =3D 0;
> intg_reg5_d(1) =3D0;
>
> for i=3D2:length(data_in)
>
> =A0 =A0 intg_reg1_d(i) =3D intg_reg1(i-1);
> =A0 =A0 intg_reg1(i) =3D intg_reg1_d(i) + data_in(i);
>
> =A0 =A0 intg_reg2_d(i) =3D intg_reg2(i-1);
> =A0 =A0 intg_reg2(i) =3D intg_reg2_d(i) + intg_reg1_d(i);
>
> =A0 =A0 intg_reg3_d(i) =3D intg_reg3(i-1);
> =A0 =A0 intg_reg3(i) =3D intg_reg3_d(i) + intg_reg2_d(i);
>
> =A0 =A0 intg_reg4_d(i) =3D intg_reg4(i-1);
> =A0 =A0 intg_reg4(i) =3D intg_reg4_d(i) + intg_reg3_d(i);
>
> =A0 =A0 intg_reg5_d(i) =3D intg_reg5(i-1);
> =A0 =A0 intg_reg5(i) =3D intg_reg5_d(i) + intg_reg4_d(i);
>
> end
>
> % Decimation by R
>
> deci_data=3Dintg_reg5_d(R:R:end);
>
> %Comb Section Registers Initialization
> diff_reg1(1) =3D deci_data(1);
> diff_reg1_d(1) =3D 0;
> diff_reg2(1) =3D 0;
> diff_reg2_d(1) =3D0;
> diff_reg3(1) =3D 0;
> diff_reg3_d(1) =3D 0;
> diff_reg4(1) =3D 0;
> diff_reg4_d(1) =3D 0;
> diff_reg5(1) =3D 0;
> diff_reg5_d(1) =3D 0;
> diff_reg6(1) =3D 0;
>
> for ii=3D2:length(deci_data)
>
> =A0 =A0 diff_reg1(ii) =3D deci_data(ii);
> =A0 =A0 diff_reg1_d(ii) =3D diff_reg1(ii-1);
>
> =A0 =A0 diff_reg2(ii) =3D diff_reg1(ii)-diff_reg1_d(ii);
> =A0 =A0 diff_reg2_d(ii) =3D diff_reg2(ii-1);
>
> =A0 =A0 diff_reg3(ii) =3D diff_reg2(ii)-diff_reg2_d(ii);
> =A0 =A0 diff_reg3_d(ii) =3D diff_reg3(ii-1);
>
> =A0 =A0 diff_reg4(ii) =3D diff_reg3(ii)-diff_reg3_d(ii);
> =A0 =A0 diff_reg4_d(ii) =3D diff_reg4(ii-1);
>
> =A0 =A0 diff_reg5(ii) =3D diff_reg4(ii)-diff_reg4_d(ii);
> =A0 =A0 diff_reg5_d(ii) =3D diff_reg5(ii-1);
>
> =A0 =A0 diff_reg6(ii) =3D diff_reg5(ii)-diff_reg5_d(ii);
> end
> data_out =3D diff_reg6;
>
> data_in =3D[1 zeros(1,4*10000-1)];
>
> hm=3Dmfilt.cicdecim(4,1,5);
> cic_ir=3Ddouble(filter(hm,data_in));

I got it! In fact double type in matlab is represented with
54(including 1 sign bit) ,so the so-call floating point simulation is
fixed-point theoritically. Thus overflow is inevitable with the
increase of integration length."Wrap-around" is needed according to
Hogenauer's paper in order to avoid overflow error.
 




 2 Posts in Topic:
5 Stages CIC Filter Matlab Simulation Problem
tonyjiang86@[EMAIL PROTEC  2008-06-26 18:39:47 
Re: 5 Stages CIC Filter Matlab Simulation Problem
Tony <tonyjiang86@[EMA  2008-06-27 01:57:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 4:08:07 CST 2008.