Traitement-signal-plantes/Code-C/power.c
2022-06-01 18:02:32 +02:00

29 lines
762 B
C

#include "power.h"
#include "getArray.h"
#include "initialParameters.h"
double power(int **p){
double periode = (1/freqEch);
printf("periode : %d\n",periode);
double power[8];
for(int i = 1; i < nCol; i++){
int j = 0;
double res = 0;
while(1){
if(!(p[j+1][i] == NULL)) break;
double aire = ( pow(p[j][i],2) + pow(p[j+1][i],2) ) / 2 * periode;
printf("aire [%d,%d] : %d\n",j,i,aire);
res += aire;
j++;
}
printf("résultat : %d\n",res);
power[i] = res;
}
return *power;
}
int main(int argc , char** argv){
int **p = getRawDataArray(nRow, nCol);
//printArray(p,nRow,nCol);
double pw = power(p);
printf("%d" , pw);
}