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