Guest User

Untitled

a guest
Oct 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. coef* t_Fourier(int *amostras, int N)
  2. {
  3. coef *saida = (coef *)calloc(N, sizeof(coef));
  4. int n, k;
  5.  
  6. for (n = 0;n < N; n++)
  7. {
  8. for (k = 0;k < N; k++)
  9. {
  10. saida[n].coef += amostras[k] * cexp( ( -2.0 * M_PI * (((n+1) * k * 1.0) / ( N * 1.0 ) ) ) * _Complex_I );
  11. }
  12. if ( n < 5 ) printf ("%lf %lf\n", __real__ saida[n].coef, __imag__ saida[n].coef );
  13. }
  14. return saida;
  15. }
  16.  
  17.  
  18. int *amostras;
  19. amostras = (int *)calloc(count, sizeof(int));
  20. rewind(input);
  21. while(fread(&amostras[i], sizeof(unsigned char), 1, input) > 0)
  22. {
  23. i++;
  24. }
  25. fclose(input);
Add Comment
Please, Sign In to add comment