Question: Design a flow chart based on this C++ code #include #include #define PI 3.14159265 const int k = 20; struct DFT_Coefficient { double real, img;

Design a flow chart based on this C++ code

#include #include #define PI 3.14159265 const int k = 20;

struct DFT_Coefficient { double real, img; };

int main(int argc, char **argv) { const int N = 10; float a, b, c; int i, j; struct DFT_Coefficient dft_val[k]; double cosine[N]; double sine[N];

printf("Discrete Fourier Transform using naive method "); printf("Enter the coefficient of simple linear function: "); printf("ax + by = c "); scanf_s("%f", &a); scanf_s("%f", &b); scanf_s("%f", &c); double function[N]; for (i = 0; i < N; i++) { function[i] = (((a * (double)i) + (b * (double)i)) - c); //System.out.print( " "+function[i] + " "); } for (i = 0; i < N; i++) { cosine[i] = cos((2 * i * k * PI) / N); sine[i] = sin((2 * i * k * PI) / N); }

printf("The coefficients are: "); for (j = 0; j < k; j++) { for (i = 0; i < N; i++) { dft_val[j].real += function[i] * cosine[i]; dft_val[j].img += function[i] * sine[i]; } printf("( %e ) - ( %e i) ", dft_val[j].real, dft_val[j].img); } return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!