Traitement-signal-plantes/Code-C/growthRate.c
2023-06-01 17:22:38 +02:00

42 lines
1.1 KiB
C

#include "./Include/initialParameters.h"
#include "./Include/fileGestion.h"
#include "./Include/getArray.h"
#include "./Include/growthRate.h"
/**
* @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++)
{
gRateArray[i] = (dataArray[0][i] - dataArray[1][i]) / period;
}
}
/**
* @brief calcul then print differentiate in csv
*
* @param dataLign
*/
void growthRateFunction(double **dataLign, char *fileName)
{
double gRateArray[nCol - 1];
growthRateCalculation(dataLign, gRateArray);
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++;
}
}
}