From d5325f4a59429ef54f69e52f9d8e8a1278039ca0 Mon Sep 17 00:00:00 2001 From: Minh Dan Cam Date: Tue, 3 Dec 2024 12:28:01 +0100 Subject: [PATCH] Initial commit --- MMS24_25.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ MMS24_25.h | 14 ++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 MMS24_25.c create mode 100644 MMS24_25.h diff --git a/MMS24_25.c b/MMS24_25.c new file mode 100644 index 0000000..070e9d6 --- /dev/null +++ b/MMS24_25.c @@ -0,0 +1,47 @@ +// +// Created by minhd on 03.12.2024. +// + +#include "MMS24_25.h" +#include "math.h" +#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; +} + +void rescaleDoubleArray(double *pdIn, int iLen, int iMin, double dFactor, double *pdOut){ + for (int i = 0; i < iLen; i++) { + pdOut[i] = pdIn[i + iMin] * dFactor; + } +} + +double *generateSineValues(int iNumValues, int iNumSamplesPerPeriod, double dAmp){ + double* sineArray = (double*)malloc(iNumValues * sizeof(double)); + for (int i=0; i