Convolution in C

This is a discussion on Convolution in C within the C Programming forums, part of the General Programming Boards category; 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]); ...

  1. #1
    rrr
    rrr is offline
    Registered User
    Join Date
    Jan 2011
    Posts
    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,
    Last edited by Salem; 01-20-2011 at 01:25 AM. Reason: Added [code][/code] tags - learn to use them yourself

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    "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. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    [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 subscribe to a feed

Similar Threads

  1. Profiling and benchmarking
    By audinue in forum Tech Board
    Replies: 9
    Last Post: 09-07-2009, 05:35 AM
  2. FFT and convolution
    By DavidP in forum General Discussions
    Replies: 7
    Last Post: 07-03-2009, 10:31 AM
  3. Caught In The Convolution Matrix
    By SMurf in forum Game Programming
    Replies: 3
    Last Post: 11-25-2007, 10:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21