Hello every one,
I am trying to create the c program which will
perform the equivalent function of filter(b,a,x) command as in matlab
which is used to calculate the output of any Non-linear TI system for
any input x here is my code with using user defined header file .
header file(input.h)
int input(int a[10])
{
int L,i;
printf("\nEnter the total length of string?");
scanf("%d",&L);
for (i=0;i
{
printf("\nenter the value of position number %d?",i+1);
scanf("%d",&a[i]);
}
return(L);
}
main program(filter.c)
#include
static int x[10];
static int y[10];
static int a[10];
static int b[10];
void main ()
{
int i,j,k,Lx,Lb,La;
clrscr();
printf("enter parameter for input");
Lx=input(x);
printf("enter parameters for b");
Lb=input(b);
printf("enter parameters for a");
La=input(a);
printf("\n\n\ninput vector is \n");
for(i=0;i
printf("%d ",x[i]);
printf("\n\n\na vector is \n");
for(i=0;i
printf("%d ",a[i]);
printf("\n\n\nb vector is \n");
for(i=0;i
printf("%d ",b[i]);
printf("\n");
for(i=0;i
{
y[i]=0;
k=i;
for(j=0;j
if(k>=0);
y[i]+=b[j]*x[k--];
k=i-1;
for(j=0;j
if(k>=0)
y[i]-=a[j]*y[k--];
}
printf("\n\n\n output vector is \n");
for(i=0;i
printf("%d ",y[i]);
getch();
}
i am every time getting vector y as null vector plz tell me where is the
mistake or why it is not wroking . or please give me suggestion to
enhance the code
thanks
Regards,
Muhammad Naveed