Fix reference before definition
This commit is contained in:
parent
7e20e4eb19
commit
5b65a43431
42
MMS24-25.c
42
MMS24-25.c
@ -399,10 +399,10 @@ void deleteExtrema(Extrema *pexIn) {
|
||||
}
|
||||
|
||||
void initMMSignalFeatures(MMSignal *pmmsIn) {
|
||||
pmmsIn->dArea = calculateArea(pmmsIn->pdValues, pmmsIn->iNumValues);
|
||||
pmmsIn->dMean = calculateMean(pmmsIn->pdValues, pmmsIn->iNumValues);
|
||||
pmmsIn->dStdDev = calculateStddev(pmmsIn->pdValues, pmmsIn->iNumValues);
|
||||
pmmsIn->dMedian = calculateMedian(pmmsIn->pdValues, pmmsIn->iNumValues);
|
||||
pmmsIn->dArea = 0;
|
||||
pmmsIn->dMean = 0;
|
||||
pmmsIn->dStdDev = 0;
|
||||
pmmsIn->dMedian = 0;
|
||||
pmmsIn->pexExtrema = initExtrema(pmmsIn->pdValues, pmmsIn->iNumValues);
|
||||
}
|
||||
|
||||
@ -496,3 +496,37 @@ MMSignal *getPascalLine(int iLinenum) {
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Aufgabe 4
|
||||
void computeDFT(int iLen,
|
||||
double *pdRealIn, double *pdImgIn,
|
||||
double *pdRealOut, double *pdImgOut,
|
||||
int iDirection /*-1,1*/) {
|
||||
// Check the value of iDirection
|
||||
if (iDirection != -1 && iDirection != 1)
|
||||
_error("computeDFT: iDirection must be either -1 or 1\n");
|
||||
|
||||
for (int k = 0; k < iLen; k++) {
|
||||
pdRealOut[k] = 0;
|
||||
pdImgOut[k] = 0;
|
||||
for (int n = 0; n < iLen; n++) {
|
||||
pdRealOut[k] += pdRealIn[n] * cos(2*M_PI *k *n / iLen) + iDirection * pdImgIn[n] * sin(2*M_PI *k *n / iLen);
|
||||
pdImgOut[k] += -iDirection * pdRealIn[n] * sin(2*M_PI *k *n / iLen) + pdImgIn[n] * cos(2*M_PI *k *n / iLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void convertCart2Polar(double *pdRealIn, double *pdImgIn, double *pdRadiusOut, double *pdAngleOut, int iLen) {
|
||||
for (int i = 0; i < iLen; i++) {
|
||||
pdRadiusOut[i] = sqrt(pow(pdRealIn[i], 2) + pow(pdImgIn[i], 2));
|
||||
pdAngleOut[i] = atan2(pdImgIn[i], pdRealIn[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void convertPolar2Cart(double *pdRadiusIn, double *pdAngleIn, double *pdRealOut, double *pdImgOut, int iLen) {
|
||||
for (int i = 0; i < iLen; i++) {
|
||||
pdRealOut[i] = pdRadiusIn[i] * cos(pdAngleIn[i]);
|
||||
pdImgOut[i] = pdRadiusIn[i] * sin(pdAngleIn[i]);
|
||||
}
|
||||
}
|
||||
// #endregion
|
||||
|
||||
Loading…
Reference in New Issue
Block a user