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

36 lines
1.1 KiB
C
Raw Normal View History

2022-12-01 17:29:47 +01:00
#include "include/initialParameters.h"
#include "include/fileGestion.h"
#include "include/getArray.h"
#include "include/growthRate.h"
2022-06-15 11:57:15 +02:00
/**
* @brief calculate de growth rate between to point next to each other
*
* @param dataArray array with data of points next to each other for each captor (dim : 2 * nCols)
* @param gRateArray array that contaigns results of the growth ratecalculation
*/
void growthRateCalculation(double **dataArray , double *gRateArray){
for(int i = 0 ; i < nCol-1 ; i++){
2022-06-16 14:35:02 +02:00
gRateArray[i] = (dataArray[0][i] - dataArray[1][i]) / period;
2022-06-15 11:57:15 +02:00
}
}
2022-06-16 14:35:02 +02:00
/**
* @brief calcul then print differentiate in csv
*
* @param dataLign
*/
2022-06-16 17:05:12 +02:00
void growthRateFunction(double **dataLign , char* fileName){
2022-06-15 11:57:15 +02:00
double gRateArray[nCol-1];
2022-06-16 14:35:02 +02:00
growthRateCalculation(dataLign , gRateArray);
2022-06-16 17:05:12 +02:00
appendDataInFile(fileName,gRateArray , nCol-1);
}
void sumColArray(long **p, double res[] , int N , int M){
for(int i = 1; i < M; i++){
int j = 0;
res[i] = 0;
while(j < N){
res[i] += p[i][j];
j++;
}
}
2022-06-15 11:57:15 +02:00
}