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

Click For Summary
To create a transfer function from an incoming signal processed by an analog-to-digital converter (ADC), one must apply a Fast Fourier Transform (FFT) to analyze the signal's frequency components. The process involves stepping through a range of frequencies using a variable frequency signal source and recording the ADC output to determine the input-output relationship. For voice analysis, the signal is captured through a microphone, and the resulting data can be used to derive the transfer function mathematically. It's important to understand that the transfer function can be represented in the z-domain, where the relationship between input and output sequences is established. Ultimately, the goal is to compute the discrete Fourier transform of the sampled signal to visualize its frequency spectrum.
  • #31
I took
f(t) = SIN(10*t) +SIN(5*t)
and got this
f(0) = 0
f(1) = -1.5
f(2) = 0.4
f(3) = -0.3

now I tried to do the DFT
Fs = 4Hz
N = 4 samples
3
f[r] = Ʃ x[k]ε^(-j(2πkr/4)
k=0

f[r] = 0 -1.5ε^(-j(2πr/4) + 0.4ε^(-j(2π(2)r/4) -0.3ε^(-j(2π(3)r/4)
f[0] = 0 - 1.5 + 0.4 - 0.3 = -1.4 // now that mean i have a frequency of 0 but I do not..
f[1] = 0 + 1.5j -0.4 -0.3 = 1.5j -0.7
f[2] = 0 +1.5 + 0.4 +0.3 = 2.2
f[3] = 0 -1.5-0.4 +0.3j = -1.9 + 0.3j

ok so I think I am close to understand how to do a DFT but I know that is wrong because I do not have a 0Hz frequency nor do I have a 2Hz frequency
I have 5 and 10
 
Engineering news on Phys.org
  • #32
@analogdesign
I think you totally missed what the OP was asking for. He wanted to know how to convert the time sequenced samples from an A/D into a continuous function. He did not know that he could just operate on the samples directly. As for your description the the A/D transfer function, it is much more complex that you inferred. The A/D converts a continuous time input waveform into a sequence of impulses spaced in time. The OP drew this as connected points, but it should be a series of spikes. This can often be overlooked, but is important, especially once aliasing needs to be understood.

Now he is trying to do the DFT on the sample sequence and having difficulty with the DSP.

@btb4198

You are on the right track.

There are windowing effects and other things that make your results hard to interpret. For now let's just do a simple sine wave.

Produce a 1 Hz sine wave and sample it evenly 16 times such that the 17th sample would be at 0.

Take the DFT and see what you get. Now do the same for a 2Hz sine wave at the same sample rate such that you now have sampled 2 cycles of the sinewave. You should get nice clean "single bin" answers. Once you are successful with that we can move on. The key here is that, for now, your samples should start and end such that if you repeated the waveform there would be no discontinuities. We will explain that later.
 
Last edited:
  • #33
meBigGuy:

ok from 0 to 80, I pull every 16 value 6 times..

I think that is what you wanted me to do

I did F(t) = sin(t) to get 1 Hz

5
F[r] = Ʃ X[K]ε^(-j(2πKr/6))
k=0

F[r] = 0 - 0.287ε^((-J*2*π r)/6) + 0.551ε^((-J*2*π*(2)*r)/6) - 0.768ε^((-J*2*π* (3) *r)/6)
+ 0.920ε((-J*2*π *(4)*r)/6) - 0.993ε^((-J*2*π *(5)* r)/6)
F[0] = -0.993
F[1] = -1 -0.287(0.5-0.86j) - 0.55j + 0.768 + 0.920(-0.5 +0.866j) - 0.993(0.5 + 0.866j)

ok I am doing something wrong ? is this the wrong equation?
 
  • #34
Not sure what you did.

Use a series of samples made up from the values you get from sin(2*pi*n*1/16) with n=0,1,2,3,4...15. This would be the same as the values you would get from sampling a 1V 1Hz sine wave at 1/16th second intervals. Then do the same for 16 samples of sin(2*2*pi*n*1/16) which would be the 16 samples for a 2 Hz sine wave. Do the DFT for those two sample sequences.
 
  • #35
analogdesign said:
The LSB of a delta sigma ADC is based on a different algorithm entirely...

the LSB in a ΔΣ is about wherever the designer says it is. because in the decimation process the word width grows and they end up with many more bits than is the resolution of the ADC. you can conceptually get more bits out (which changes who the LSB is) but they get noisier and noisier. eventually they decide that there is nothing to be gained by making the word wider.
 
  • #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 ?
 
  • #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

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 16 ·
Replies
16
Views
9K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 31 ·
2
Replies
31
Views
11K
Replies
9
Views
4K
Replies
20
Views
2K
Replies
5
Views
3K
  • · Replies 19 ·
Replies
19
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
37
Views
6K