Jump to content
Science Forums

FFT and DFT in C++


Recommended Posts

Why hello there!

 

Three days ago I started relearning C++ at work as a large section of my work will entail interfacing with PCs via I/O cards, mostly preforming signal analysis. I have got all the basic commands down I belive, such as for loops, ifs, and am comfident with most of the operators.

 

My boss has decided that as I am fairly competent i should learn "to do somthing useful." he wants me to first produce a sine wave then draw this using Timage. this was fairly simple and i got it completed in about an hour. Next i need to preform a Fast Fourier Transform on the sine wave and draw the output from this using Timage. Once i have got that completed he wants me to draw a cosine wave using Timage, then preform a Discrete Fourier Transform on the cosine wave and draw the output again with Timage.

 

I tried some existing code that another member of the team at work has used but I cant get it to work. My boss said that the manner in which i produced the sine wave is wrong, the code I used is:

 

for(int i=0;i<points;i++)

{

sinearray= sin(Pi/180*i);

}

 

is there a better way to generate a sine wave? i am using Borland Turbo C++ and so have to work in radians. any help with any of the above tasks would be greatly apreciated.

 

many thanks pigeon :phones:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...