89 lines
2.4 KiB
C
89 lines
2.4 KiB
C
//
|
|
// Created by frederikbeimgraben, minhdancam, leahornberger on 03.12.2024.
|
|
//
|
|
|
|
#ifndef MMS24_25_H
|
|
#define MMS24_25_H
|
|
|
|
typedef struct {
|
|
double *pdValues;
|
|
int iNumValues;
|
|
} MMSignal;
|
|
|
|
typedef struct {
|
|
int iNumLocalExtrema;
|
|
int *piLocalExtremaPos;
|
|
} LocalExtrema;
|
|
|
|
typedef struct {
|
|
int iGlobalMinPos;
|
|
int iGlobalMaxPos;
|
|
LocalExtrema *pexLocalMax;
|
|
LocalExtrema *pexLocalMin;
|
|
} Extrema;
|
|
|
|
typedef struct {
|
|
double dIntervalMin;
|
|
double dIntervalMax;
|
|
double dBinWidth;
|
|
int iNumBins;
|
|
double *pdBinValues;
|
|
} Histogram;
|
|
|
|
/***************************
|
|
* AUFGABE 1
|
|
****************************/
|
|
|
|
double interpolateLine(double dX1,double dY1,double dX2, double dY2, double dXq);
|
|
void rescaleDoubleArray(double *pdIn, int iLen, double dMin, double dFactor, double *pdOut);
|
|
double *generateSineValues(int iNumValues, int iNumSamplesPerPeriod, double dAmp);
|
|
void writeDoubleArray(double *pdOut, int iLen, char *pcOutName);
|
|
|
|
/**************************************
|
|
* read a linebreak separated numbers from a file
|
|
*
|
|
* input:
|
|
* pcInName - Name of the file to be read
|
|
* ppdIn - pointer holding the reference to the data array created by this function after reading
|
|
*
|
|
* output:
|
|
* Length of the array of double values created by this function
|
|
*
|
|
***************************************/
|
|
int readDoubleArray(char *pcInName, double **ppdIn);
|
|
|
|
MMSignal *createSignal();
|
|
MMSignal *createSignalFromDoubleArray(int iArrayLen, double *pdIn);
|
|
MMSignal *createSignalFromFile(char *pcInName);
|
|
MMSignal *readMMSignal(char *pcInName);
|
|
void writeMMSignal(char *pcInName, MMSignal *pmmsIn);
|
|
|
|
void deleteSignal(MMSignal *pmmsIn);
|
|
|
|
/********************************
|
|
* AUFGABE 2
|
|
********************************/
|
|
|
|
double calculateArea(double *pdIn, int iLen);
|
|
double calculateMean(double *pdIn, int iLen);
|
|
double calculateStddev(double *pdIn, int iLen);
|
|
double calculateMedian(double *pdIn, int iLen);
|
|
Extrema *initExtrema(double *pdIn, int iLen);
|
|
void deleteExtrema(Extrema *pexIn);
|
|
Histogram *initHistogram(double *pdIn, int iLen, int iNumBins);
|
|
void deleteHistogram(Histogram *phisIn);
|
|
double calculateEntropy(Histogram *phisIn);
|
|
|
|
/********************************
|
|
* AUFGABE 3
|
|
********************************/
|
|
MMSignal *convoluteSignals(MMSignal *pmmsInA,MMSignal *pmmsInB);
|
|
double *getPascalLine(int iLinenum);
|
|
|
|
/********************************
|
|
* AUFGABE 4
|
|
********************************/
|
|
|
|
#endif //MMS24_25_H
|
|
|