On Wednesday 21 April 2010 23:02:19 Arnold Krille wrote: > Okay, the answers teach me that this is wrong. I didn't yet think about > this as in-depth as I should have before writing that. I did some thinking... Attached is a small python script that generates some sinus data at 0.5, 0.49 and 0.25 the sampling rate, phase shifted pi/2 to the sampling clock. But the phase shift can be adapted in the first lines. Then it does fft on these. While the nyquist frequency shows up as amplitude 0 (for phase = pi/2) and 2 (for phase 0), the others remain at amplitude 1 no matter what the phase is. Sounds strange, especially when you see the perceived amplitude-modulation for f=0.49, but in the end its up to the analog filters to create a smaller than nyquist frequency sinus from the steps returned by the dac... It is also clear, why f=0.5, phase=0 shows an amplitude of 2: All the frequencies are endlessly mirrored to the left and right. And at f = 0.5*samplingrate, the mirror and the original are the same. So sorry for the fuss I tried to spread. Should have done this little exercise earlier. Have fun, Arnold
#!/usr/bin/env python import numpy import matplotlib.pyplot as plt n = 100 phase = numpy.pi/2. data = [] for f in [0.5, 0.49, 0.25, 0.01]: tmp = [] for i in range(n): tmp.append(numpy.cos(i * f * 2*numpy.pi + phase)) data.append(tmp) #plt.plot(data) plt.subplot(221) for d in data: plt.plot(d) freqs = None for d in data: if freqs is None: freqs = [] for i in range(n/2 +1): freqs.append(i*1./n) tmp = numpy.fft.rfft(d) plt.subplot(212) plt.plot(freqs,abs(tmp)*2/n) plt.subplot(222) plt.plot(freqs,numpy.angle(tmp)) plt.show()
Attachment:
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Linux-audio-user mailing list Linux-audio-user@xxxxxxxxxxxxxxxxxxxx http://lists.linuxaudio.org/listinfo/linux-audio-user