From 2da64ab8e3f31e2f107d95ae4a99748bf827d3df Mon Sep 17 00:00:00 2001 From: Liu Yuting L16101157 <101034703+L16101157@users.noreply.github.com> Date: Sun, 6 Mar 2022 14:13:09 +0800 Subject: [PATCH 1/2] Update 5_practice.c --- 5_practice.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/5_practice.c b/5_practice.c index 70d6651..092a658 100644 --- a/5_practice.c +++ b/5_practice.c @@ -2,6 +2,9 @@ #include // for memory allocation #include // for time calculation #include // for sine and cosine functions + +//For pull request + int main() { // Declare all the variables int k, n, N; From 317b8aaf6d5b4fbcaa1626ff19edd331aae6b3eb Mon Sep 17 00:00:00 2001 From: Liu Yuting L16101157 <101034703+L16101157@users.noreply.github.com> Date: Wed, 9 Mar 2022 21:09:02 +0800 Subject: [PATCH 2/2] Raw DFT --- 5_practice.c | 120 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 81 insertions(+), 39 deletions(-) diff --git a/5_practice.c b/5_practice.c index 092a658..8d5262c 100644 --- a/5_practice.c +++ b/5_practice.c @@ -1,43 +1,85 @@ -#include // for printf function -#include // for memory allocation -#include // for time calculation -#include // for sine and cosine functions +// +// DFT +// +// Created by Liu Yuting on 2022/3/9. +// -//For pull request +#include +#include +#include +#include -int main() { - // Declare all the variables - int k, n, N; - double *x, *yr, *yi; - time_t t; +int main(int argc, const char * argv[]) { + // Declare variables. + int N=7; + int n, k; + int index; + + double *x, *yr, *yi, *cos_array, *sin_array; + x=(double *) malloc(N*sizeof(double)); + yr=(double *) malloc(N*sizeof(double)); + yi=(double *) malloc(N*sizeof(double)); + cos_array=(double *) malloc(N*sizeof(double)); + sin_array=(double *) malloc(N*sizeof(double)); + for(n=0; n