# Thread: Convolution in C

1. ## Convolution in C

Code:
```#include<stdio.h>
#include<math.h>
#include<conio.h>
#include<stdlib.h>
double o[6]={0,0,0,0,0,0};

int main()
{
int i;
int x,y;
double f[7]={3.2,3.4,5.3,4.5,6.5,0,0};
double a[7]={1.2,3.2,0,0,0,0,0};

o[1]=(f[1]*\a[1]);
printf("%f",o[1]);

/*for(x=0;x<6;x++)
{
o[x]=0;

for(y=0;y<1;y++)
{
if(x-y+1>0)
{
o[x]=o[x]+(a[y]*f[x-y+1]);
}
}
}
for(i=0;i<6;i++)
{
printf("%f\n",o[i]);
}*/
system("pause");
return(0);
}```
Why is this not working? i checked, n i found that the multiplication is not taking place properly,

2. "f[1]*\a[1]"? Really?

Also your if statement has a 1 in it, which it shouldn't. (Which, incidentally, also erroneously appears in your f[] thing.)

3. [QUOTE=rrr;996925]
Code:
```#include<stdio.h>
#include<math.h>
#include<conio.h>
#include<stdlib.h>
double o[6]={0,0,0,0,0,0};

int main()
{
int i;
int x,y;
double f[7]={3.2,3.4,5.3,4.5,6.5,0,0};
double a[7]={1.2,3.2,0,0,0,0,0};

o[1]=(f[1]*\a[1]);  <--- syntax error

printf("%f",o[1]);

/*for(x=0;x<6;x++)     <--- all this is commented out
{
o[x]=0;

for(y=0;y<1;y++)
{
if(x-y+1>0)
{
o[x]=o[x]+(a[y]*f[x-y+1]);
}
}
}
for(i=0;i<6;i++)
{
printf("%f\n",o[i]);
}*/                         system("pause");
return(0);
}

Why is this not working? i checked, n i found that the multiplication is not taking place properly,```

Popular pages Recent additions