9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia03/ex35.c (482B)
   1 #include <stdio.h>
   2 #include <math.h>
   3 
   4 #define PI 3.1415922654
   5 
   6 int main (void)
   7 {
   8     size_t i, samples, interval;
   9     double amp, frequency, time, phi;
  10 
  11     amp = 100;
  12     frequency = 20;
  13     time = 0;
  14     phi = 0.1;
  15 
  16     samples = 10;
  17     interval = 1;
  18 
  19     double data[samples];
  20 
  21     for(i = 0; i < samples; i++, time += interval) {
  22         data[i] = (amp * sin((2 * PI * frequency * time) + phi));
  23 //        printf("data: %ld\n", data[i]);
  24         printf("sin: %ld\n", sin((2 * PI * frequency * time) + phi));
  25     }
  26 
  27     return 0;
  28 }