From 0aae3d6102477aa4657e15408944dc9b48d43d4b Mon Sep 17 00:00:00 2001 From: leah Date: Tue, 3 Dec 2024 12:34:23 +0100 Subject: [PATCH 1/4] 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 + From 3d94802bebfe2cbc6f852eb09f1c4fc67b6ad783 Mon Sep 17 00:00:00 2001 From: Frederik Beimgraben Date: Tue, 3 Dec 2024 12:39:03 +0100 Subject: [PATCH 2/4] docs[README]: Add Style guidelines to README.md Commit message guidelines and variable naming. --- .idea/.gitignore | 8 + .idea/MMS-Loesung-2024-25.iml | 8 + .idea/editor.xml | 580 ++++++++++++++++++++++++++++++++++ .idea/modules.xml | 8 + .idea/vcs.xml | 6 + README.md | 8 +- 6 files changed, 617 insertions(+), 1 deletion(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/MMS-Loesung-2024-25.iml create mode 100644 .idea/editor.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/MMS-Loesung-2024-25.iml b/.idea/MMS-Loesung-2024-25.iml new file mode 100644 index 0000000..bc2cd87 --- /dev/null +++ b/.idea/MMS-Loesung-2024-25.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/editor.xml b/.idea/editor.xml new file mode 100644 index 0000000..95d51a7 --- /dev/null +++ b/.idea/editor.xml @@ -0,0 +1,580 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..1ec52fe --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 5d1bec0..1e172b6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # MMS-Loesung-2024-25 -MMS-Lösung zum Headerfile im WiSe 2024/25 \ No newline at end of file +MMS-Lösung zum Headerfile im WiSe 2024/25 + +## Code Style and Conventions + +We adhere to the [Angular Commit Message Conventions](https://www.conventionalcommits.org/en/v1.0.0-beta.4/) + +Function names as well as variables should be written in camelCase. \ No newline at end of file From a09d3e51419b891a5778ec9b010fb760f22d6e39 Mon Sep 17 00:00:00 2001 From: Frederik Beimgraben Date: Tue, 3 Dec 2024 12:45:28 +0100 Subject: [PATCH 3/4] feat[main]: Add main()-Function in main.c --- .gitignore | 1 + MMS24_25.c | 5 ----- main.c | 10 ++++++++++ 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 main.c diff --git a/.gitignore b/.gitignore index cd531cf..6065ccf 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ Module.symvers Mkfile.old dkms.conf +main \ No newline at end of file diff --git a/MMS24_25.c b/MMS24_25.c index 070e9d6..12108f4 100644 --- a/MMS24_25.c +++ b/MMS24_25.c @@ -7,11 +7,6 @@ #include #include -#ifdef _DEBUG_ -printf("X=%f\n",x); -#endif - - double interpolateLine(double x1, double y1,double x2, double y2, double x){ double y = ((y2 - y1) / (x2 - x1)) * x + y1 - ((y2 - y1) / (x2 - x1)) * x1; return y; diff --git a/main.c b/main.c new file mode 100644 index 0000000..30607dd --- /dev/null +++ b/main.c @@ -0,0 +1,10 @@ +// +// Created by frederik on 12/3/24. +// + +#include "MMS24_25.h" +#include + +int main(const int argc, const char * argv[]) { + +} \ No newline at end of file From 48b1871244a6a130916856ef3e55ec483f6328fb Mon Sep 17 00:00:00 2001 From: Frederik Beimgraben Date: Tue, 3 Dec 2024 12:47:14 +0100 Subject: [PATCH 4/4] refactor[main]: Add `return 0;` to `main(...)` --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 30607dd..350f018 100644 --- a/main.c +++ b/main.c @@ -6,5 +6,5 @@ #include int main(const int argc, const char * argv[]) { - + return 0; } \ No newline at end of file