Connect with us

FFT of two sine waves added

Discussion in 'General Electronics Discussion' started by Anjana_U, Feb 7, 2017.

Scroll to continue with content
  1. Anjana_U

    Anjana_U

    1
    0
    Feb 7, 2017
    I am trying to find the fft of 2 sine waves added. The platform used is visualdsp++ and target processor is ADSP BF537. code-


    section("L1_data_a")
    float inp1[1024];

    section("L1_data_b")
    complex_fract32 out[1024;

    section("L1_data_a")
    complex_fract32 tw[1024];

    section("L1_data_b")
    fract32 mag[1024];
    void main(void)
    {

    unsigned int i;
    int wst = 1;
    int block_exponent;
    int scale_method = 1;
    int mode=1;
    float fs=100.0, f2=10.0, f1=20.0;
    float constant= (2*3.142)/fs;
    twidfftrad2_fr32(tw, 1024);
    asm("nop;");
    //--------------------Create frequency samples---------------------//


    for(i=0;i<1024;i++)
    {
    inp1=(10*sin(constant*f1*i))+(10*sin(constant*f2*i));
    }

    asm("nop;");

    //------------------fft radix_2 library function --------------------//
    rfft_fr32((fract32)inp1, out, tw, wst, 1024, &block_exponent, scale_method);
    asm("nop;");

    memset(mag,0,1024);
    //------------------------Mangnitude calculation--------------------//
    fft_magnitude_fr32(out,mag,1024,block_exponent,mode);
    asm("nop;");
    }




    When mag is plotted(Line plot), peak is obtained at 200. Shouldn't there be two peaks at two different frequencies?
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-