#include <stdio.h> #include <math.h> #define N1 6 /* x array size */ #define N2 1 /* B term coefficient number */ #define N3 4 /* A term coefficient number */ int main() { int i,j,n,m; array double complex x[N1],v[N2],u[N3],zi[N3-1],zf[N3-1]; array double x1[N1],v1[N2],u1[N3],y1[N1]; array double complex y[N1]; for (i=0;i<N1;i++){ real(x[i])=i+1; imag(x[i])=i-1; x1[i] = i+1; } for (i=0;i<N3;i++) { real(u[i])=i+1; imag(u[i])=i+1; u1[i] = i+1; } for (i=0;i<N2;i++) { v[i]=i+1; v1[i] = i+1; } for (i=0;i<N3-1;i++) { zi[i]=1; } filter(v,u,x,y,zi,zf); /* User specified initial delays */ printf("u=%6.3f\n",u); printf("v=%6.3f\n",v); printf("x=%6.3f\n",x); printf("y=%6.3f\n",y); printf("zi=%6.3f\n",zi); printf("zf=%6.3f\n",zf); filter(v1,u1,x1,y1); /* User did not specify initial delays */ printf("u1=%6.3f\n",u1); printf("v1=%6.3f\n",v1); printf("x1=%6.3f\n",x1); printf("y1=%6.3f\n",y1); return 0; }
u=complex( 1.000, 1.000) complex( 2.000, 2.000) complex( 3.000, 3.000) complex( 4.000, 4.000) v=complex( 1.000, 0.000) x=complex( 1.000,-1.000) complex( 2.000, 0.000) complex( 3.000, 1.000) complex( 4.000, 2.000) complex( 5.000, 3.000) complex( 6.000, 4.000) y=complex( 1.000,-1.000) complex( 0.000, 1.000) complex( 0.000, 0.000) complex(-1.000, 0.000) complex( 6.000,-5.000) complex(-4.000, 9.000) zi=complex( 1.000, 0.000) complex( 1.000, 0.000) complex( 1.000, 0.000) zf=complex(-6.000,-3.000) complex(-12.000,-7.000) complex(16.000,-36.000) u1= 1.000 2.000 3.000 4.000 v1= 1.000 x1= 1.000 2.000 3.000 4.000 5.000 6.000 y1= 1.000 0.000 0.000 0.000 5.000 -4.000