View Single Post
  #26 (permalink)  
Old 03-15-2010, 10:46 AM
agraham's Avatar
agraham agraham is offline
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by klaus View Post
I suppose that your algorithm is a real input DFT.
I'm not sure what you mean by "your algorithm" but the library does a complex input FFT. I think the long words and funny symbols in the articles that I Google are the problem to my not understanding.

If I set the imaginary part of the input to 0 and make a Cosine input by altering your Sub CalcSin as follows I get what I expect. A Real (Cosine) as a fourth harmonic and two Imaginary (Sine) harmonics as the fundamental and the tenth. I sort of understand this but don't know what the negative signs of the Imaginary values mean or why the Imaginary conjugates are of opposite sign whereas the Real conjugates aren't, something to do with "i" presumably.
Code:
Sub CalcSin(nb)
    
Dim I As Number
    
Dim j As Number, w0 As Number, w1 As Number, w2 As Number
    
    w0=
cPI/ND2
    w1=
cPI/ND2*4
    w2=
cPI/ND2*10
    
    lbxResult.Clear
    
For i=0 To NM1<font color="red"Step 2</font>
        data(i)=
Sin(w0*i)
        <font color=
"Red">data(i+1) = 0</font>
        
If nb=3 Then
            data(i)=data(i)+<font color=
"Red">Cos</font>(w1*i)
            data(i)=data(i)+
Sin(w2*i)
        
End If
        lbxResult.Add(i&
"  "&data(i))
    
Next
    FillList(NM1,
"Sinus")
End Sub
With your original Sub, which inputs samples in both Real and Imaginary input parts the FFT produces aproximate values of

Real at 1 of 1024, 4 of 1 of 1018, 10 of 1024
and at 2047(1) of, 1025, 2044(4) of 1024, 2038(10) of 1040

Imag at 1 of -1022, 4 of 1024, 10 of -1008
and at 2047(1) of, 1025, 2044(4) of 1024, 2038(10) of 1040

What I don't understand is what these represent. Presumably they are amplitudes and obviously they are at the input frequencies but the signs of the values puzzle me. It looks like the initial values in the Imaginary output carry phase information but the relected values of the Imaginary don't, presumably its' something to with "i" again
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote