From 0aae3d6102477aa4657e15408944dc9b48d43d4b Mon Sep 17 00:00:00 2001 From: leah Date: Tue, 3 Dec 2024 12:34:23 +0100 Subject: [PATCH] aktualisierte Header-Datei --- MMS24_25.h | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 5 deletions(-) diff --git a/MMS24_25.h b/MMS24_25.h index 7cb9776..91ee884 100644 --- a/MMS24_25.h +++ b/MMS24_25.h @@ -1,14 +1,88 @@ // -// Created by minhd on 03.12.2024. +// Created by frederikbeimgraben, minhdancam, leahornberger on 03.12.2024. // -#ifndef MMS_LOESUNG_2024_25_MMS24_25_H -#define MMS_LOESUNG_2024_25_MMS24_25_H +#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, int iMin, double dFactor, double *pdOut); +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); -#endif //MMS_LOESUNG_2024_25_MMS24_25_H +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 +