Sign in

username:

password:



Not a member?

Search c54x



Search tips

Subscribe to c54x



c54x by Keywords

5409 | 5416 | AD5 | ADC | BIOS | Boot | Booting | Bootloader | C540 | C5402 | C5409 | C5416 | CCS | Codec | DMA | Dmad | DSK | DSKPlus | Dsplib | EVM | FFT | FIR | Flash | GPIO | HPI | Initialization | Interrupt | JTAG | LOG_printf | MCBSP | RFFT | RTDX | Sampling | STLM | UART | VC540

Ads

Discussion Groups

Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).

  

Post a new Thread

- Grant Jennings - Jun 5 16:55:52 2007



Hello,

I'm trying to implement a cascading iir and here's my code for the first
second order z transform.  I'm I going about this correctly? My output is
good till a particular value and then it starts having problems.  Any help
or links to a good example would be great!

Thanks,
Grant

float b[3] = {1,2,1};
float a[3] = {1,-1.9985996261556458,0.99952100328066507};
float y[151]={0};
int i=0;
char wait;

while(i<151)
{
       x[i] *= 7.0818881108085789e-7;
if(i==0)
       y[i] = x[i];
if(i==1)
       y[i] = x[i] + b[1]*x[i-1] - a[1]*y[i-1];
if (i>1)
       y[i] = x[i] + b[1]*x[i-1] + b[2]*x[i-2] - a[1]*y[i-1] -
a[2]*y[i-2];
cout<<y[i]<<" "<<i<<"\n";

i++;
}



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

i also tried this - itsmejustpurely - Jun 5 18:13:41 2007

x = x * 7.0818881108085789e-7;

y = b[0]*x + d[0];
d[0] = b[1]*x - a[1]*y + d[1];
d[1] = b[2]*x - a[2]*y + d[2];

cout<<y<<" "<<x<<" "<<x1<<"
"<<x2<<"\n";
i+=.001;
same results

--- In c...@yahoogroups.com, "Grant Jennings" <gtjennings@...> wrote:
>
> Hello,
> 
> I'm trying to implement a cascading iir and here's my code for the first
> second order z transform.  I'm I going about this correctly? My
output is
> good till a particular value and then it starts having problems. 
Any help
> or links to a good example would be great!
> 
> Thanks,
> Grant
> 
> float b[3] = {1,2,1};
> float a[3] = {1,-1.9985996261556458,0.99952100328066507};
> float y[151]={0};
> int i=0;
> char wait;
> 
> while(i<151)
> {
>        x[i] *= 7.0818881108085789e-7;
> if(i==0)
>        y[i] = x[i];
> if(i==1)
>        y[i] = x[i] + b[1]*x[i-1] - a[1]*y[i-1];
> if (i>1)
>        y[i] = x[i] + b[1]*x[i-1] + b[2]*x[i-2] - a[1]*y[i-1] -
> a[2]*y[i-2];
> cout<<y[i]<<" "<<i<<"\n";
> 
> i++;
> }
>



(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )