Compare commits
2 commits
9cd8d2bc7e
...
c66535111d
Author | SHA1 | Date | |
---|---|---|---|
c66535111d | |||
7d024ff384 |
39
Code-C/growthrate.c
Normal file
39
Code-C/growthrate.c
Normal file
|
@ -0,0 +1,39 @@
|
|||
#include "average.h"
|
||||
#include "getArray.h"
|
||||
#include "fileGestion.h"
|
||||
#include "initialParameters.h"
|
||||
#include "queue.h"
|
||||
|
||||
/**
|
||||
* @brief realize the growthRate calcul
|
||||
*
|
||||
* @param p array with all the values that will be used for the calcul
|
||||
* @param powerArray array where results are stocked
|
||||
*/
|
||||
void growthRateCalculation(long **p, double powerArray[]){
|
||||
for(int i = 1; i < nCol; i++){
|
||||
int j = 0;
|
||||
powerArray[i] = 0;
|
||||
while(j < nRow-1){
|
||||
double aire = ( pow(p[j][i],2) + pow(p[j+1][i],2) ) / 2 * period;
|
||||
powerArray[i] += aire;
|
||||
j++;
|
||||
}
|
||||
powerArray[i] *= invTimeBandWidth;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief function that realize all the action to write one lign in the file growthRateData.csv
|
||||
*
|
||||
* @param rawDataFileName name of the raw data file to use to realize the calcul
|
||||
*/
|
||||
void growthRate(char* rawDataFileName){
|
||||
long **p = getRawDataArray(rawDataFileName), ;
|
||||
double gRate[nCol -1];
|
||||
if(p !=NULL){
|
||||
growthRateCalculation(p,gRate);
|
||||
appendDataInFile("averageData.csv",aver,nCol-1);
|
||||
freeArray(p,nRow);
|
||||
}
|
||||
}
|
4
Code-C/growthrate.h
Normal file
4
Code-C/growthrate.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
#include <math.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
void growthRate(char* rawDataFileName);
|
BIN
Code-C/main
BIN
Code-C/main
Binary file not shown.
Loading…
Reference in a new issue