How can I use an ADC to create a transform function for an incoming signal?

In summary: If you know the peak-to-peak input amplitude at each frequency, you can use a simple linear equation to solve for the transfer function H(t). Otherwise, you could use a digital oscilloscope to plot the input signal voltage against the ADC output code, and solve for the transfer function that way.
  • #36
@ meBigGuy
so I did it like you said and I got

f[0] = 0 // this is good
f[1] = 15.794j
now I do not know why I got a J but I did... and
now why did I have to add (2*pi)?
the 1/16 what does that do ? only pull ever 16 value from the sine-wave?

also what is the windowing effects ?
 
Engineering news on Phys.org
  • #37
for the human voice how fast should sample?
 
  • #38
1. The 1/16 defines the sample period. You could pull as many samples as you want.
2. Think of a single cycle of a sine wave as being 360 degrees, or 2*pi radians. You are taking 16 samples at a uniform phase step for a 1 Hz sine wave. If you wanted a 1 radian per second sine wave you could remove the 2*pi.
3. Not sure about the j.

Did you try the 2Hz sine wave and see the 16 move to the next bin?

Windowing functions become important when you deal with real world data where the period is not an integer multiple of the sample rate. The DFT is assuming an infinitely repeating sequence. Imagine you only took 14 samples of the sine wave, and concatenated 10 sample buffers. There would be a discontinuity in the wave form at the end of each buffer. This causes artifacts in the frequency domain. Windowing is used to reduce these artifacts. Look up window function on wikipedia.

Your sample rate must be at least 2 times higher than the highest frequency in your input. Not the highest frequency you are interested in , but the highest frequency actually present. Usually there needs to be an input anti-aliasing filter before the A/D. Look up Aliasing.
 
  • #39
do to get Voltages back ?
is that what the F[r] is Voltages ?
 
  • #40
how do you graph a -j?
 
  • #41
You need to re-read what I have posted since the beginning, read the stuff I've pointed you to, and think a bit more about what you have learned. That you would ask me about F[r] indicates you don't understand what a DFT actually does. Do some more research.

http://mathworld.wolfram.com/DiscreteFourierTransform.html
http://www.engineeringproductivitytools.com/stuff/T0001/PT01.HTM
http://www.csie.nctu.edu.tw/~cmliu/Courses/dsp/chap8.pdf

And on and on and on.

You really need to take a DSP class. There are lots of online classes and lectures that can explain this to you.
 
  • #42
ok i wrote a program and i tested for
2Hz sine wave
10*sin(2*2*pi*n*1/16)
and I got this

0
7.07106781186547
10
7.07106781186548
1.22460635382238E-15
-7.07106781186547
-10
-7.07106781186548
-2.44921270764475E-15
7.07106781186547
10
7.07106781186548
3.67381906146713E-15
-7.07106781186548
-10
-7.07106781186548
-4.89842541528951E-15
F[0] = (-8.88178419700125E-15, 0)
F[1] = (-7.105427357601E-15, 2.66453525910038E-15)
F[2] = (-3.5527136788005E-15, 5.32907051820075E-15)// why is this 0?
F[3] = (-8.88178419700125E-16, 7.105427357601E-15)
F[4] = (-7.39557098644699E-31, 8.88178419700125E-15)
 
Last edited:
  • #43
F[2] = 3.5527136788005E-15 that is the real part...
 
  • #44
Fr = Sample rate / number of sample
F = n * Fs

n = the r from F[r]

so one you get r
do you have to do

F = n* Fs

to get the frequency?
 
  • #45
ok I an now setting up my test sine wave right
can someone help me?
 
  • #46
ok I just used this
f[t] = 1000* Cos( 10*2* PI *t )
and I got 1000 over and over again
and how I did get this
F[0] = 2000
F[1] = 0 , f[2] = 0 and so on
now I do not know what I got 1000 over and over again but I do know that is a Frequency of 0.

so I really think I need help with my test sin waves
 
  • #47
FFT imaginary vs REAL

I have a working DFT and FFT now that I coded in a program ..

now from testing I can see that with both the FFT and the DFT if I just graph the Imaginary number I will get the right frequency
for example:
F[t] = 10 Sin((2 * PI * 2000 *t)/8000) 0 <t <1024
will get me
a frequency

2000 Hz and 6000 Hz now I do know that 6000 Hz is the - frequency in the sin wave

but I a graph my Real numbers I get
0 Hz
4000Hz
Why is that ?
should I only use my imaginary values and for get about my real value ?

also my magnitude for all the Frequencies are the same 65535 can I get something from that ?
 
  • #48
6000 is an alias, not a negative frequency.

1024 samples at 8000 hz means a nyquist of 4000 hz. Basically it is saying that if the original frequency was 6000 Hz you would have gotten the same sample values.

Choose a frequency such that there are an exact number of cycles in your sample (use 2048 Hz and /8192 for a 1024 sample sequence. You will still see beyond nyquist, but it should bin better.
 
  • #49
@byb4198
I still can't be sure what it is that you actually want to know and how 'basic' your original question was. Would I be right in thinking that your question has been morphing in response to the answers you've been getting, which may have been taking you away from where you originally wanted to be? (The original confusion between transfer and transform was the result of a seriously de-stabilising signal, injected in the system:wink:)

It's relatively easy to show the Voltage / Number transfer function will be a linear set of amplitude steps - which can be given in the form of a graph or as a truth table. Assuming that you are using a 'boxcar' waveform for the familiar quantised (quasi analog) signal (or the numerical output value), you can say what the frequency spectrum of this quantised signal will be, for any arbitrary input signal. It can be found using a DFT. But, as the ADC is a highly non linear process, the resulting distortions can't easily be described as a simple function.
Could we sort one thing out at a time. Firstly, are you happy with the amplitude transfer function?
 
  • #50
Yes I guess ...
 
  • #51
Did you want to take it further? It gets a lot more murky.
 

Similar threads

  • Electrical Engineering
Replies
4
Views
839
Replies
1
Views
815
Replies
9
Views
2K
Replies
20
Views
1K
  • Electrical Engineering
Replies
31
Views
9K
Replies
6
Views
2K
  • Electrical Engineering
Replies
14
Views
3K
Replies
15
Views
1K
Replies
37
Views
3K
  • Electrical Engineering
Replies
16
Views
8K
Back
Top