Traitement-signal-plantes/Code-C/power.c

23 lines
522 B
C
Raw Normal View History

2022-06-01 12:32:04 +02:00
#include "power.h"
#include "getArray.h"
2022-06-01 17:01:23 +02:00
double power(int **p){
2022-06-01 12:32:04 +02:00
double periode = 1 /freqEch;
double power[8];
for(int i = 0; i < 8; i++){
int j = 0;
double res = 0;
while(1){
2022-06-01 17:01:23 +02:00
if(!p[j+1][i]) break;
double aire = ( pow(p[j][i],2) + pow(p[j+1][i],2) ) / 2 * periode;
2022-06-01 12:32:04 +02:00
res += aire;
j++;
}
power[i] = res;
}
return *power;
}
int main(int argc , char** argv){
2022-06-01 17:01:23 +02:00
double pw = power(getArray());
2022-06-01 12:32:04 +02:00
printf("%d" , pw);
}