1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Calculating velocity correlation function

  1. May 28, 2012 #1
    Hi,

    I have been trying to write a code to calculate velocity correlation function so that I can obtain a frequency spectrum for my system on taking a fourier transform. For testing my code I generated a sine wave data and calculated vcf and took dft. I got correct frequency value but the peak splits into two (the value should be 1.6 but I get two peaks 1.58 and 1.62) and there are several small peaks in the spectrum.

    I am pasting the vcf calculation part below. Could someone please help me find a flaw in my logic?

    Thanks a lot!

    vcf = 0
    do m = 2, Nmax, dnsample !loop thorugh all time origins
    vm=v(m)
    denom=(Nmax-m)/dnsample
    norm=1/denom
    do n = 2, Nmax-m, dnsample !loop over velocity at time t points
    vdot = vm * v(m+n)
    vmag = v(m+n) * v(m+n)
    vcf = vcf + (vdot/vmag)
    end do
    time = m*0.5*1d-13
    vcf = vcf*norm
    write(4,*) time, vcf
    end do
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Calculating velocity correlation function
  1. Correlation function (Replies: 2)

Loading...