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.
  • #1
btb4198
572
10
I have a incoming signal from a analog to digital converter, how do I turn it into a transform function ?

so how to turn a graph into a transform function?
So want to take the incoming signal and used a fast Fourier transform (FFT).
so I will take the incoming signal built a function from there
f(t) = incoming signal
then built a transform function
H(t) = incoming signal as transform function
than do a
F(w) = FFT of incoming signal.
 
Last edited:
Engineering news on Phys.org
  • #2
well, i know what a "[Fourier|Laplace|Hilbert|Z] transform" is and i know what a "transfer function" is, but i am unsure what a "transform function" is.

could you help identify or define that term?
 
  • #3
sorry...
I meant transfer function
 
  • #4
btb4198 said:
I have a incoming signal from a analog to digital converter, how do I turn it into a transform function ?

so how to turn a graph into a transform function?
So want to take the incoming signal and used a fast Fourier transform (FFT).
so I will take the incoming signal built a function from there
f(t) = incoming signal
then built a transform function
H(t) = incoming signal as transform function
than do a
F(w) = FFT of incoming signal.

btb4198 said:
sorry...
I meant transfer function

To gather the data for your transfer function and graph it, you will need to have a variable frequency signal source. You will slowly step the signal source from the lowest to the highest frequency of interest, in frequency steps that make sense to you for your system. You will compare the peak-to-peak input signal amplitude to the biggest-minus-smallest ADC output numbers that you get at each frequency, and then produce your transfer function graph from those data.

Make sense?
 
  • #5
the variable frequency signal source will be a human. I am doing voice analysis.
so I will not know the frequency.
I will be reading a human voice signal into a mic and to a computer.
what do you mean by frequency steps ?

I Know the sign will be a some thing like
H(t) = Asin(tF)

something like that right ?
 
  • #6
btb4198 said:
the variable frequency signal source will be a human. I am doing voice analysis.
so I will not know the frequency.
I will be reading a human voice signal into a mic and to a computer.
what do you mean by frequency steps ?

I Know the sign will be a some thing like
H(t) = Asin(tF)

something like that right ?

If you want to know the transfer function, you will need to borrow/buy a variable frequency signal generator that covers the audio frequency range. You will also need an oscilloscope to observe the input signal to your circuit, to verify what the Vpp amplitude is.

You could vary the input signal from 20Hz to say 10kHz, and do it in logarithmic steps to save some test time. Like, 20Hz, 50Hz, 100Hz, 200Hz, 500Hz, 1kHz, 2kHz, 5kHz, 10kHz. At each frequency, you will read the ADC output a bunch of times, to determine what the maximum and minimum output codes are. The peak-to-peak output from the ADC is just the difference between that maximum and minimum code. Determine this input-to-output amplitude behavior for each of the test frequencies, and plot that on a graph.

Presumably the transfer function should be pretty flat if everything is working okay, at least in the passband of your input filter that you have placed before the ADC. You do have an anti-alias filter in front of the ADC, right? What frequency does your ADC sample at? What order is your anti-alias filter, and where have you placed the cutoff?
 
  • #7
right now I just want to know how to do it on paper ...
I need to know the math behind getting a transfer function from a graph..

then I am going with write a program in C# and using the mic built into my computer ..
 
  • #8
btb4198 said:
right now I just want to know how to do it on paper ...
I need to know the math behind getting a transfer function from a graph..

then I am going with write a program in C# and using the mic built into my computer ..

I'm pretty sure that I've explained it fully. Whether on paper or in practice. If there are parts of my explanation that you don't understand yet, please ask questions. There are many folks here who can answer your questions on this subject.
 
  • #9
given this graph
how would you solve for f(x)
and
than how do you solve for H(W) ?
how would you solve for the transfer function

so you know the Y axle is in voltages (V)
and the X axle is Time ( milliseconds)

also how would you solve for
Fourier transform?
 

Attachments

  • graph.png
    graph.png
    17 KB · Views: 518
  • #10
You have a real time sequence of discrete sample points. Think of them a impulses from a perfect A/D converter. Maybe that is what you mean by transfer function of an A/D converter.

For the Fourier transform, assuming periodic sampling, you just operate on the points with the DFT (discrete Fourier transform - see wikipedia).

That should get you started. Also look at the wikipedia page on Digital Signal Processing.
 
  • #11
But I still do not know how to solve for F(t) and I have been looking online , but I can't seem to find anything on how to get a transfer function from a graph ..
 

Attachments

  • graph2.png
    graph2.png
    30.7 KB · Views: 572
  • graph3.jpg
    graph3.jpg
    20 KB · Views: 588
  • #12
so given the graph above how to I know what
f(t) = ?
and
H(W) =?
also the those two graphs are the same graph...
the Y axle is in voltages (V)
and the X axle is Time ( milliseconds)
 
  • #13
btb4198 said:
so given the graph above how to I know what
f(t) = ?
and
H(W) =?
also the those two graphs are the same graph...
the Y axle is in voltages (V)
and the X axle is Time ( milliseconds)

dunno about [itex]H(\omega)[/itex] (unless you mean [itex]h(t)[/itex] instead of "[itex]f(t)[/itex]"), but, as drawn, [itex]f(t)[/itex] is a piecewise-linear function that can only be expressed in terms of the actual data of the vertices at the sampling instances.
 
  • #14
Your graph is a picture of a time varying waveform draw by connecting discrite sample points. What do you mean solve for f(t)? You want to determine a best fit to a polynomial of some form assuming it is infinitely repeating? You want that equation to include the linear interpolation you drew between sample points? Of what use is that form?

Are you saying you want some sort of mathematical representation of an arbitrary waveform input through an A/D converter? What form do you want the equation to take? You can solve for the best fit coefficients of a polynomial of whatever degree you like, or for the coefficients for a Fourier series. Again, I see no use for that information.

In discrite time processing, the input sequence IS the representation of f(t). You can analyze that sequence to determine things about it. If you have two sequences, you can learn things about how they are correlated, etc. So, where in continuous time systems you may have a linear equation for a signal, in discrite time systems you have a sequence of values and a sample frequency.

For transfer functions you basically work in the z domain which is analogous to the s domain in continuous waveform systems. You seem to be referring to the basic principles of digital signal processing.

From wikipedia:
In discrete-time systems, the relation between an input signal x(t) and output y(t) is dealt with using the z-transform, and then the transfer function is similarly written as H(z) = {Y(z)}/{X(z)} and this is often referred to as the pulse-transfer function.

x(t) and y(t) are literally the discrite time sequence of samples.
 
  • #15
Just to be clear, are you just trying to compute the discrete Fourier transform of your sampled signal so you can view its spectrum etc.? As in, you want to make a recording of your voice and then determine its frequency spectrum? If that's the case, your thread title is rather misleading.

You could, of course, find the Z-transform X(z) of your time series and make the substitution z = e to produce its discrete-time Fourier transform (DTFT). From that, you could find its discrete Fourier transform (DFT), but it's a very convoluted way of going about it and, most importantly, you aren't employing a fast Fourier transform (FFT) to do it.

A FFT produces the DFT of your time series directly from its samples. All you really need to do is implement a FFT algorithm. The Cooley–Tukey algorithm is very common:
http://en.wikipedia.org/wiki/Cooley–Tukey_FFT_algorithm
 
  • #16
Ok so the graph i upload. I make it with Excel so I know it is f(t) = 5 SIN(5t) + 10SIN(t10) + 20SIN(6t)
But If someone just gave me that graph, how would I get f(t) = 5 SIN(5t) + 10SIN(t10) + 20SIN(6t)? if some one gave me the graph and did not get me the function f(t) how would i know what the function f(t) is?

once I can determine what the function f(t) is
than I can get H(W) from f(t)
H(W) = the transfer function of f(t) ...
then I can solve for the Fourier transform F(w)
and then I can get frequency spectrum with would be Voltages vs Frequency.
 
  • #17
rbj said:
dunno about [itex]H(\omega)[/itex] (unless you mean [itex]h(t)[/itex] instead of "[itex]f(t)[/itex]"), but, as drawn, [itex]f(t)[/itex] is a piecewise-linear function that can only be expressed in terms of the actual data of the vertices at the sampling instances.


what do you mean is can only be
expressed in terms of the actual data of the vertices at the sampling instances
?
f(t) = 5 SIN(5t) + 10SIN(t10) + 20SIN(6t)
Now how do I get "5 SIN(5t) + 10SIN(t10) + 20SIN(6t)" from the graph I posted ?
one I know how to determine the function f(t) from any incoming signal ,
then I can do
F(w) = ∫f(t) ε^jwt Δt
 
  • #18
Yes I do want to "compute the discrete Fourier transform of my sampled signal so I can view its spectrum etc As in, I want to make a recording of my voice and then determine its frequency spectrum."
but I will need know what f(t)...
without knowing the function f(t) I can't do anything...
and if you can get a graph from f(t) = 5 SIN(5t) + 10SIN(t10) + 20SIN(6t)
then you should be able to get f(t) = 5 SIN(5t) + 10SIN(t10) + 20SIN(6t) from a graph right??
just going backward some kind of way...
 
  • #19
something like this...

 
Last edited by a moderator:
  • #20
btb4198 said:
without knowing the function f(t) I can't do anything...
and if you can get a graph from f(t) = 5 SIN(5t) + 10SIN(t10) + 20SIN(6t)
then you should be able to get f(t) = 5 SIN(5t) + 10SIN(t10) + 20SIN(6t) from a graph right??
just going backward some kind of way...

I think you are missing the point.
Firstly, in general you CANT determine what "the function" looked like, there is an infinite number possible equations that could fit the data.

However, if you assume that the data is of a form that where it can be approximated by a sum of sin functions (which is what you are doing) you can use a discrete Fourier transform (DFT), There is no need to first calculate f(t), you just apply the DFT to the raw data.

In fact, one could think of a Fourier transform as the process of finding the the pre-factors that give you a "best fit" to your data. Once you have the DFT you could (in theory) plot f(t) if you wanted. That said, in reality it becomes more complicated, which is why calculating DFTs for real data isn't entirely trivial if you want very accurate results.
 
Last edited by a moderator:
  • #21
like this
? I have been watching this but i am lost
can you post an example ?
 
Last edited by a moderator:
  • #22
btb4198 said:
Now how do I get "5 SIN(5t) + 10SIN(t10) + 20SIN(6t)" from the graph I posted ?

By computing the Discrete Fourier Transform on the samples series that you distorted by drawing lines between the points. By understanding the difference between continuous and sampled data systems. By understanding Digital Signal Processing and the z-domain.

You have what you need already. You mistakenly want to try to convert the data samples into an equation for a continuous signal. That isn't how it is done. You just operate on the samples themselves to get whatever information you need.

You need to start at chapter 1 of the course you posted. Or try the wikipedia DFT page.
 
Last edited:
  • #23
Too complex guys. The transfer function of a well-designed ADC is just a single gain value. Analog in, data out. Basically the "gain" of an ADC is 1/LSB. So if you have a linear ADC with an LSB of 1 mV, the transfer function of the ADC is 1000 DN/V. DN here means Digital Number, V is volts.

Everything else is a second-order effect.
 
  • #24
analogdesign said:
Too complex guys. The transfer function of a well-designed ADC is just a single gain value. Analog in, data out. Basically the "gain" of an ADC is 1/LSB. So if you have a linear ADC with an LSB of 1 mV, the transfer function of the ADC is 1000 DN/V. DN here means Digital Number, V is volts.

Everything else is a second-order effect.

this is sort of true. i would say that the gain of an ADC would be inversely proportional to the Vref either internally or externally determined. and the gain of a DAC would be directly proportional to its Vref.

one thing, a DAC (not the ADC, which is a common mistake some people make) has an additional transfer function applied called a zero-order hold. the ZOH is not part of the ADC function, nor that of any sample-and-hold preceding the ADC. another common mistake to avoid is the missing [itex]T[/itex] factor in the denominator. the Wiki page is correct, nearly all EE textbooks get it sort of wrong, both with the sampling theorem (which leads to the mistake in the ZOH). the ZOH transfer function must be dimensionless and, in the sampling theorem, the reconstruction LPF must also be dimensionless. most textbooks have the sampling period [itex]T[/itex] as the passband gain of the reconstruction filter, and putting that factor there only serves to confuse.
 
  • #25
analogdesign

could you give an example ?
I am some what new to this, and I did not understand what you posted.
 
  • #26
btb4198 said:
analogdesign

could you give an example ?
I am some what new to this, and I did not understand what you posted.

Your thread title reads 'transfer function of an ADC', which is something very different than what you're actually trying to find.

So again, if you're looking to determine the frequency spectrum of a sampled signal (your voice recording), you need to read up a bit on the discrete Fourier transform and possibly how you can calculate it using a FFT algorithm.
 
  • #27
btb4198 said:
analogdesign

could you give an example ?
I am some what new to this, and I did not understand what you posted.

No problem. It is actually pretty simple.

A transfer function is a mathematical function that describes the way that a system affects the different frequencies going through it. It is typically given in the Laplace or Fourier domain.

For example, a 1st order passive RC low pass filter's transfer function has a value of 1 for low frequencies (frequencies below the cut off), a value of 0.707 (or 1/sq-rt(2) ) at the cutoff frequency, and its value falls at 20 dB/decade after that.

The original poster asked about an ADC. Typically an ADC does not change the relationships between the frequencies as the signal is passed from its analog input to its digital output. Assuming we are sampling fast enough so there is not significant aliasing, that means the transfer function is a constant.

What I mean by this is the ADC does not filter the signal. It simply converts it to digital form.

The value of the constant can be thought of as the ADC "gain" in the sense that it is converting volts to digital numbers. The "gain" is simply a constant of proportionality.

So, the transfer function of the ADC is H(w) = C. The value of C = 1/LSB, where LSB is the least significant bit, or the value in volts of a single bit switching.

Is that clear?
 
  • #28
rbj said:
this is sort of true. i would say that the gain of an ADC would be inversely proportional to the Vref either internally or externally determined. and the gain of a DAC would be directly proportional to its Vref.

I would say the LSB of the ADC is directly proportional to the Vref used. So we're both right. :)
 
  • #29
analogdesign said:
I would say the LSB of the ADC is directly proportional to the Vref used. So we're both right. :)

perhaps. i just want to make it clear that if you increase Vref on an ADC (assuming it's allowed and doesn't fry the chip), the digital signal coming out of it decreases in amplitude.

the LSB is something i don't see as directly adjustable. it is what it is.
 
  • #30
rbj said:
perhaps. i just want to make it clear that if you increase Vref on an ADC (assuming it's allowed and doesn't fry the chip), the digital signal coming out of it decreases in amplitude.

the LSB is something i don't see as directly adjustable. it is what it is.

Fair enough. Saying the digital signal decreases in amplitude when Vref is increased is the same thing as saying the LSB is proportional to Vref.

In a modern ADC the LSB is typically derived from the reference, so it most certainly is directly adjustable. Only in a Successive Approximation type ADC is it true that "it is what it is". I'm not arguing with you because we are saying essentially the same thing.

In a flash ADC, the LSB is derived by applying Vref across a resistor string, so LSB = Vref/R. (LSB is directly proportional to Vref).

In a Pipelined ADC, as long as the number of stages is fixed, the LSB is Vref/2^N, where N is the number of stages (assuming a bit-per-stage).

In a SAR, the LSB is set by a ratio of capacitances, so obviously in that case it isn't directly derived by a reference voltage. Often, however, SARs have input buffers that scale the input such that the LSB for all intents and purposes is proportional to the Vref.

The LSB of a delta sigma ADC is based on a different algorithm entirely...
 
  • #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
 
  • #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.
 

Similar threads

  • Electrical Engineering
Replies
4
Views
831
Replies
1
Views
808
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