Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

2. Identify issues/causes for the apparent conflict.

Answered: 1 week ago