Hi,
im trying to calculATE DFT through this code, i dnt know what's wrong please enlighten. Thanks

#include<conio.h>
#include <math.h>
#include <complex.h>
main()
{
int m,n,r,N,j;
float l,o;
float complex x[1000];
float real, imag;
{
for (m=1;m<=10;m++)
{
for (n=1;n<=10;n++)
{
for (j=1; j<=10;j++)
N=1000;
r=1/N;
l=sin(3*j);
printf("the value of sin is %f",l);

o=exp(6.28*m*n*r);
x[m]=0.0+I*o*l;
//real=creal(x[m]);
//imag=cimag(x[m]);
printf("the val of x[m] is %f", x[m]);

}
}
}
getch();
}

what is DFT?

DFT means discrete fourier transform.

Hi, i have slightly modified(corrected) my code but it is still not giving desired result. Discrete fourier transform is given by the expression
X_k = \sum_{n=0}^{N-1} x_n e^{-\frac{2 \pi i}{N} k n} \quad \quad k = 0, \dots, N-1

http://en.wikipedia.org/wiki/Discrete_Fourier_transform

i want this program to solve above equation.

#include<conio.h>
#include <math.h>
#include <complex.h>
main()
{
int m,n,r,N,j;

float complex x[1000],o,l;
float real, imag,pi=3.14;

for (m=1;m<=1000;m++)
{
    x[m]=0+I*0;
for (n=1;n<=1000;n++)
{

N=1000;
r=1/N;
l=sin(2*pi*3*n);

o=exp(-I*6.28*m*n*r);
x[m]=x[m]+o*l;
}
 real=creal(x[m]);
 imag=cimag(x[m]);
 printf("\n the val of x[%d",m);
 printf("] is %f+%fi", real,imag);
 }
getch();
}

hi i am a student of BCA and now a days pointers is going on in my class. i understood its basic but my refrences are not enough to cover it.
please tell me any site or any book that cover it in detail.

second one i want to know how it is useful in c programming?

Hi Aman,

you can find a very easy to understand pointer's tutorial following the link below
http://pweb.netcom.com/~tjensen/ptr/cpoint.htm
this helped me to have good understanding of concept and use of pointers.
Hope it helps!

hi i am a student of BCA and now a days pointers is going on in my class. i understood its basic but my refrences are not enough to cover it.
please tell me any site or any book that cover it in detail.

second one i want to know how it is useful in c programming?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.