Forums

Modelling of a RC series connection in time and frequency domain

Started by Eugen Artus September 7, 2009
On 7 Sep, 19:44, Tim Wescott <t...@seemywebsite.com> wrote:
> On Mon, 07 Sep 2009 09:48:56 -0700, Rune Allnor wrote: > > On 7 Sep, 17:36, Tim Wescott <t...@seemywebsite.com> wrote: > >> On Mon, 07 Sep 2009 08:30:10 -0700, Rune Allnor wrote: > >> > On 7 Sep, 15:13, julius <juli...@gmail.com> wrote: > >> >> On Sep 7, 8:00=A0am, Rune Allnor <all...@tele.ntnu.no> wrote: > > >> >> > On 7 Sep, 13:38, Eugen Artus <eugen.ar...@arcor.de> wrote: > > >> >> > > Hi! > > >> >> > > Suppose there is resistor R and a capacitor C connected in > >> >> > > series. A voltage U_0 is applied at time t=3D0. The current in =
the
> >> >> > > time domain is then > > >> >> > > I(t) =3D U_0/R * e^(-t/RC) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(1) > > >> >> > > Taking a Laplace transform and substituting s by j*2*\pi*f, I > >> >> > > get the frequency domain current: > > >> >> > > I(f) =3D U_0*C/(j*2*\pi*f*R*C+1) =A0 =A0 =A0 =A0 =A0(2) > > >> >> > > Now the problem: I defined values for U_0, R and C, calculated > >> >> > > the time domain signal by Eq. 1 and transformed it by DFT (usin=
g
> >> >> > > the Python function numpy.fft.rfft). Then, I normalized the > >> >> > > result by multiplying with 2/N, except the first and the last > >> >> > > sample, which were multiplied with 1/N. N is the number of > >> >> > > samples of the time signal. > > >> >> > > A comparison with the signal predicted by Eq. 2 shows a > >> >> > > significant difference. What am I doing wrong? > > >> >> > The error you make is that you think that the DFT and the Fourier > >> >> > Transform are the seame operation. In fact, they are fundamentall=
y
> >> >> > different: > > >> >> > - The FT works with infinitely long, continuous-time signals. - > >> >> > The DFT works with dicrete-time data of finite length. > > >> >> > These differences have a couple of consequences, like > > >> >> > - The DFT produces a discrete, finite-length spectrum - The FT > >> >> > produces a continuous, infinitely wide spectrum > > >> >> > The FT and the DFT can be linked, but then you have to apply the > >> >> > sampling theorem, map the frequency response of the RC cirquit to > >> >> > Z-transform domain by using a BiLinear Transform (BLT), and so on=
.
> > >> >> > Rune > > >> >> To add to Rune's comment, the DFT operates on discrete, finite, > >> >> PERIODIC time series and produces a discrete, finite, PERIODIC > >> >> frequency series. > > >> >> One way to get around this is to use zero padding judiciously. > > >> > Ah. Here are some data I have lying around: > > >> > x =3D [1,2,3,4,5,6,7,8,9]; > > >> > Those numbers are all there is to this data set. No more. No less. > > >> > Remind me, where is that period? > > >> No where. =A0Which is why you should use the DFT judiciously on this > >> sequence, because the DFT implicitly assumes a periodic, evenly sample=
d
> >> sequence and your sequence is not periodic. > > > ... so you seem to mean that the DFT can not be used on this sequence? > > If so, what does the numbers > > > X =3D fft(x) =3D > > [ 45.0000 > > =A0 -4.5000 +12.3636i > > =A0 -4.5000 + 5.3629i > > =A0 -4.5000 + 2.5981i > > =A0 -4.5000 + 0.7935i > > =A0 -4.5000 - 0.7935i > > =A0 -4.5000 - 2.5981i > > =A0 -4.5000 - 5.3629i > > =A0 -4.5000 -12.3636i] > > > signify? > > Well, if the sequence is taken from a program written in C, and if the > variable in question is an enumeration of fruit, and if the mapping > between meaning and numbers goes > > 1: apples > 2: oranges > 3: grapes > 4: kumquats > 5: peaches > 6: banannas > 7: grapefruit > 8: rose hips > 9: mangoes, > > then the sequence you present means Absolutely Nothing. =A0That doesn't > mean you can't take the DFT of it, just that you have chosen a > mathematical operation that means nothing to the data at hand.
The data are given. Now, incidentially, I have another data series lying around: y =3D [...,8,9,1,2,3,4,5,6,7,8,9,1,2,...] which is periodic ad infinitum with one period yp given as yp =3D [1,2,3,4,5,6,7,8,9]. The DFT of this sequence is Y =3D fft(yp) =3D [ 45.0000 -4.5000 +12.3636i -4.5000 + 5.3629i -4.5000 + 2.5981i -4.5000 + 0.7935i -4.5000 - 0.7935i -4.5000 - 2.5981i -4.5000 - 5.3629i -4.5000 -12.3636i] I can't tell form the result of the DFT computation that there is any difference between x and y. Can you? Of course, there is also the pre- annd post-zero padded infinite sequence z =3D [...,0,0,0,1,2,3,4,5,6,7,8,9,0,0,0] with nonzero segment zz given as zz =3D [1,2,3,4,5,6,7,8,9]. Not surprisingly, the DFT of this segment is Z =3D fft(zz) =3D [ 45.0000 -4.5000 +12.3636i -4.5000 + 5.3629i -4.5000 + 2.5981i -4.5000 + 0.7935i -4.5000 - 0.7935i -4.5000 - 2.5981i -4.5000 - 5.3629i -4.5000 -12.3636i] Not even here do I see any difference with either X or Y. Could you please explain this? Rune
On Mon, 07 Sep 2009 11:21:25 -0700, Rune Allnor wrote:

> On 7 Sep, 19:44, Tim Wescott <t...@seemywebsite.com> wrote: >> On Mon, 07 Sep 2009 09:48:56 -0700, Rune Allnor wrote: >> > On 7 Sep, 17:36, Tim Wescott <t...@seemywebsite.com> wrote: >> >> On Mon, 07 Sep 2009 08:30:10 -0700, Rune Allnor wrote: >> >> > On 7 Sep, 15:13, julius <juli...@gmail.com> wrote: >> >> >> On Sep 7, 8:00&nbsp;am, Rune Allnor <all...@tele.ntnu.no> wrote: >> >> >> >> > On 7 Sep, 13:38, Eugen Artus <eugen.ar...@arcor.de> wrote: >> >> >> >> > > Hi! >> >> >> >> > > Suppose there is resistor R and a capacitor C connected in >> >> >> > > series. A voltage U_0 is applied at time t=0. The current in >> >> >> > > the time domain is then >> >> >> >> > > I(t) = U_0/R * e^(-t/RC) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(1) >> >> >> >> > > Taking a Laplace transform and substituting s by j*2*\pi*f, I >> >> >> > > get the frequency domain current: >> >> >> >> > > I(f) = U_0*C/(j*2*\pi*f*R*C+1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(2) >> >> >> >> > > Now the problem: I defined values for U_0, R and C, >> >> >> > > calculated the time domain signal by Eq. 1 and transformed it >> >> >> > > by DFT (using the Python function numpy.fft.rfft). Then, I >> >> >> > > normalized the result by multiplying with 2/N, except the >> >> >> > > first and the last sample, which were multiplied with 1/N. N >> >> >> > > is the number of samples of the time signal. >> >> >> >> > > A comparison with the signal predicted by Eq. 2 shows a >> >> >> > > significant difference. What am I doing wrong? >> >> >> >> > The error you make is that you think that the DFT and the >> >> >> > Fourier Transform are the seame operation. In fact, they are >> >> >> > fundamentally different: >> >> >> >> > - The FT works with infinitely long, continuous-time signals. - >> >> >> > The DFT works with dicrete-time data of finite length. >> >> >> >> > These differences have a couple of consequences, like >> >> >> >> > - The DFT produces a discrete, finite-length spectrum - The FT >> >> >> > produces a continuous, infinitely wide spectrum >> >> >> >> > The FT and the DFT can be linked, but then you have to apply >> >> >> > the sampling theorem, map the frequency response of the RC >> >> >> > cirquit to Z-transform domain by using a BiLinear Transform >> >> >> > (BLT), and so on. >> >> >> >> > Rune >> >> >> >> To add to Rune's comment, the DFT operates on discrete, finite, >> >> >> PERIODIC time series and produces a discrete, finite, PERIODIC >> >> >> frequency series. >> >> >> >> One way to get around this is to use zero padding judiciously. >> >> >> > Ah. Here are some data I have lying around: >> >> >> > x = [1,2,3,4,5,6,7,8,9]; >> >> >> > Those numbers are all there is to this data set. No more. No less. >> >> >> > Remind me, where is that period? >> >> >> No where. &nbsp;Which is why you should use the DFT judiciously on this >> >> sequence, because the DFT implicitly assumes a periodic, evenly >> >> sampled sequence and your sequence is not periodic. >> >> > ... so you seem to mean that the DFT can not be used on this >> > sequence? If so, what does the numbers >> >> > X = fft(x) = >> > [ 45.0000 >> > &nbsp; -4.5000 +12.3636i >> > &nbsp; -4.5000 + 5.3629i >> > &nbsp; -4.5000 + 2.5981i >> > &nbsp; -4.5000 + 0.7935i >> > &nbsp; -4.5000 - 0.7935i >> > &nbsp; -4.5000 - 2.5981i >> > &nbsp; -4.5000 - 5.3629i >> > &nbsp; -4.5000 -12.3636i] >> >> > signify? >> >> Well, if the sequence is taken from a program written in C, and if the >> variable in question is an enumeration of fruit, and if the mapping >> between meaning and numbers goes >> >> 1: apples >> 2: oranges >> 3: grapes >> 4: kumquats >> 5: peaches >> 6: banannas >> 7: grapefruit >> 8: rose hips >> 9: mangoes, >> >> then the sequence you present means Absolutely Nothing. &nbsp;That doesn't >> mean you can't take the DFT of it, just that you have chosen a >> mathematical operation that means nothing to the data at hand. > > The data are given.
Why are you playing games today? You've given no data, just some numbers. Without explaining the meaning of the numbers they are -- well -- meaningless. That's my whole point. To continue is just to blow smoke in hopes that my point will be obscured.
> > Now, incidentially, I have another data series lying around: > > y = [...,8,9,1,2,3,4,5,6,7,8,9,1,2,...] > > which is periodic ad infinitum with one period yp given as > > yp = [1,2,3,4,5,6,7,8,9]. > > The DFT of this sequence is > > Y = fft(yp) = > [ 45.0000 > -4.5000 +12.3636i > -4.5000 + 5.3629i > -4.5000 + 2.5981i > -4.5000 + 0.7935i > -4.5000 - 0.7935i > -4.5000 - 2.5981i > -4.5000 - 5.3629i > -4.5000 -12.3636i] > > I can't tell form the result of the DFT computation that there is any > difference between x and y. Can you?
Not from the result of the DFT, but because the DFT can be interpreted as being exactly correct when applied to periodic, sampled data, then it can be interpreted as a harmonic decomposition of the original series.
> > Of course, there is also the pre- annd post-zero padded infinite > sequence > > z = [...,0,0,0,1,2,3,4,5,6,7,8,9,0,0,0] > > with nonzero segment zz given as > > zz = [1,2,3,4,5,6,7,8,9]. > > Not surprisingly, the DFT of this segment is > > Z = fft(zz) = > [ 45.0000 > -4.5000 +12.3636i > -4.5000 + 5.3629i > -4.5000 + 2.5981i > -4.5000 + 0.7935i > -4.5000 - 0.7935i > -4.5000 - 2.5981i > -4.5000 - 5.3629i > -4.5000 -12.3636i] > > Not even here do I see any difference with either X or Y. > > Could you please explain this? > > Rune
And here the DFT is a very crude approximation of what's 'really' going on with the sequence; the correct way to get a spectrum of this one would be with a Fourier transform. But my overall explanation is that you are trying to make my point for me, by finding numerous examples of randomly applying the DFT to vectors of numbers in ways that are sometimes potentially meaningful and sometimes not. But I can't for the life of me explain why you are doing this, and why you couch it in language that implies you are doing the opposite. -- www.wescottdesign.com
On 7 Sep, 23:21, Tim Wescott <t...@seemywebsite.com> wrote:
> On Mon, 07 Sep 2009 11:21:25 -0700, Rune Allnor wrote: > > On 7 Sep, 19:44, Tim Wescott <t...@seemywebsite.com> wrote: > >> On Mon, 07 Sep 2009 09:48:56 -0700, Rune Allnor wrote: > >> > On 7 Sep, 17:36, Tim Wescott <t...@seemywebsite.com> wrote: > >> >> On Mon, 07 Sep 2009 08:30:10 -0700, Rune Allnor wrote: > >> >> > On 7 Sep, 15:13, julius <juli...@gmail.com> wrote: > >> >> >> On Sep 7, 8:00&#2013266080;am, Rune Allnor <all...@tele.ntnu.no> wrote: > > >> >> >> > On 7 Sep, 13:38, Eugen Artus <eugen.ar...@arcor.de> wrote: > > >> >> >> > > Hi! > > >> >> >> > > Suppose there is resistor R and a capacitor C connected in > >> >> >> > > series. A voltage U_0 is applied at time t=0. The current in > >> >> >> > > the time domain is then > > >> >> >> > > I(t) = U_0/R * e^(-t/RC) &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;(1) > > >> >> >> > > Taking a Laplace transform and substituting s by j*2*\pi*f, I > >> >> >> > > get the frequency domain current: > > >> >> >> > > I(f) = U_0*C/(j*2*\pi*f*R*C+1) &#2013266080; &#2013266080; &#2013266080; &#2013266080; &#2013266080;(2) > > >> >> >> > > Now the problem: I defined values for U_0, R and C, > >> >> >> > > calculated the time domain signal by Eq. 1 and transformed it > >> >> >> > > by DFT (using the Python function numpy.fft.rfft). Then, I > >> >> >> > > normalized the result by multiplying with 2/N, except the > >> >> >> > > first and the last sample, which were multiplied with 1/N. N > >> >> >> > > is the number of samples of the time signal. > > >> >> >> > > A comparison with the signal predicted by Eq. 2 shows a > >> >> >> > > significant difference. What am I doing wrong? > > >> >> >> > The error you make is that you think that the DFT and the > >> >> >> > Fourier Transform are the seame operation. In fact, they are > >> >> >> > fundamentally different: > > >> >> >> > - The FT works with infinitely long, continuous-time signals. - > >> >> >> > The DFT works with dicrete-time data of finite length. > > >> >> >> > These differences have a couple of consequences, like > > >> >> >> > - The DFT produces a discrete, finite-length spectrum - The FT > >> >> >> > produces a continuous, infinitely wide spectrum > > >> >> >> > The FT and the DFT can be linked, but then you have to apply > >> >> >> > the sampling theorem, map the frequency response of the RC > >> >> >> > cirquit to Z-transform domain by using a BiLinear Transform > >> >> >> > (BLT), and so on. > > >> >> >> > Rune > > >> >> >> To add to Rune's comment, the DFT operates on discrete, finite, > >> >> >> PERIODIC time series and produces a discrete, finite, PERIODIC > >> >> >> frequency series. > > >> >> >> One way to get around this is to use zero padding judiciously. > > >> >> > Ah. Here are some data I have lying around: > > >> >> > x = [1,2,3,4,5,6,7,8,9]; > > >> >> > Those numbers are all there is to this data set. No more. No less. > > >> >> > Remind me, where is that period? > > >> >> No where. &#2013266080;Which is why you should use the DFT judiciously on this > >> >> sequence, because the DFT implicitly assumes a periodic, evenly > >> >> sampled sequence and your sequence is not periodic. > > >> > ... so you seem to mean that the DFT can not be used on this > >> > sequence? If so, what does the numbers > > >> > X = fft(x) = > >> > [ 45.0000 > >> > &#2013266080; -4.5000 +12.3636i > >> > &#2013266080; -4.5000 + 5.3629i > >> > &#2013266080; -4.5000 + 2.5981i > >> > &#2013266080; -4.5000 + 0.7935i > >> > &#2013266080; -4.5000 - 0.7935i > >> > &#2013266080; -4.5000 - 2.5981i > >> > &#2013266080; -4.5000 - 5.3629i > >> > &#2013266080; -4.5000 -12.3636i] > > >> > signify? > > >> Well, if the sequence is taken from a program written in C, and if the > >> variable in question is an enumeration of fruit, and if the mapping > >> between meaning and numbers goes > > >> 1: apples > >> 2: oranges > >> 3: grapes > >> 4: kumquats > >> 5: peaches > >> 6: banannas > >> 7: grapefruit > >> 8: rose hips > >> 9: mangoes, > > >> then the sequence you present means Absolutely Nothing. &#2013266080;That doesn't > >> mean you can't take the DFT of it, just that you have chosen a > >> mathematical operation that means nothing to the data at hand. > > > The data are given. > > Why are you playing games today? &#2013266080;You've given no data, just some > numbers.
Those numbers are the data. Numbers are the only kinds of data you will ever get within the realm of DSP.
>&#2013266080;Without explaining the meaning of the numbers they are -- well > -- meaningless. &#2013266080;That's my whole point. &#2013266080;To continue is just to blow > smoke in hopes that my point will be obscured.
I know you are very smart. I suspect you even understand how ridiculous the "The DFT requires periodic data" argument is. Of course, considering that almost everybody else here have bought into the delusion I can understand that you do not want to break ranks with the rest of the poeple here. But again, you are smart enough to see my point. And I'm pretty sure you do see it.
> > Now, incidentially, I have another data series lying around: > > > y = [...,8,9,1,2,3,4,5,6,7,8,9,1,2,...] > > > which is periodic ad infinitum with one period yp given as > > > yp = [1,2,3,4,5,6,7,8,9]. > > > The DFT of this sequence is > > > Y = fft(yp) = > > [ 45.0000 > > &#2013266080; -4.5000 +12.3636i > > &#2013266080; -4.5000 + 5.3629i > > &#2013266080; -4.5000 + 2.5981i > > &#2013266080; -4.5000 + 0.7935i > > &#2013266080; -4.5000 - 0.7935i > > &#2013266080; -4.5000 - 2.5981i > > &#2013266080; -4.5000 - 5.3629i > > &#2013266080; -4.5000 -12.3636i] > > > I can't tell form the result of the DFT computation that there is any > > difference between x and y. Can you? > > Not from the result of the DFT, but because the DFT can be interpreted as > being exactly correct when applied to periodic, sampled data, then it can > be interpreted as a harmonic decomposition of the original series.
The DFT can not interpret anything, because the DFT 'sees' a ninite set of numbers, and does its thing with those numbers that happen to be presented to it. No more. No less.
> > Of course, there is also the pre- annd post-zero padded infinite > > sequence > > > z = [...,0,0,0,1,2,3,4,5,6,7,8,9,0,0,0] > > > with nonzero segment zz given as > > > zz = [1,2,3,4,5,6,7,8,9]. > > > Not surprisingly, the DFT of this segment is > > > Z = fft(zz) = > > [ 45.0000 > > &#2013266080; -4.5000 +12.3636i > > &#2013266080; -4.5000 + 5.3629i > > &#2013266080; -4.5000 + 2.5981i > > &#2013266080; -4.5000 + 0.7935i > > &#2013266080; -4.5000 - 0.7935i > > &#2013266080; -4.5000 - 2.5981i > > &#2013266080; -4.5000 - 5.3629i > > &#2013266080; -4.5000 -12.3636i] > > > Not even here do I see any difference with either X or Y. > > > Could you please explain this? > > > Rune > > And here the DFT is a very crude approximation of what's 'really' going > on with the sequence; the correct way to get a spectrum of this one would > be with a Fourier transform.
Doesn't matter. I used the numbers as arguments to the DFT. Your point seems to be that in case 1, my use of the DFT is wrong because no more numbers exist in the data set than those I feed to the DFT. In case 2 you seem to think that using the DFT is correct, because of the data items I *don't* feed to the DFT. In this last case, that argument turns straight and all of a sudden the DFT is wrong because of the data points I *don't* feed to the DFT. Would you ever present that sort of argument to a paying customer? If so, would you be surprised if the same paying customer called in people to express a 2nd, a 3rd and maybe even a 4th opinion?
> But my overall explanation is that you are trying to make my point for > me, by finding numerous examples of randomly applying the DFT to vectors > of numbers in ways that are sometimes potentially meaningful and > sometimes not.
The result of the DFT always 'means' the same thing: How a given data set can be expressed in terms of a set of complex-valued basis vectors in an N-dimensional vector space.
> But I can't for the life of me explain why you are doing this, and why > you couch it in language that implies you are doing the opposite.
Again, you are a smart guy. You are amongst the very few people here that a) are smart enouhg to see that the DFT is nothing more than a basis shift transform of the data actually presented to the algorithm. b) pragmatic enough to actually change your opinions once you see that you have been wrong. Over the past few weeks I have come to realize that people I used to respect for their knowledge and skills, suffer from this DFT delution. This was too good an opportunity to test out if these people really are as stupid as they appear. Rune
Hi Rune!

> The FT and the DFT can be linked, but then you have to > apply the sampling theorem, map the frequency response > of the RC cirquit to Z-transform domain by using a > BiLinear Transform (BLT), and so on.
Ok. Would you be so kind to give a brief outline of the necessary steps to solve this particular problem? Of course, any recommendations regarding literature or websites are very welcome, too. Thank you! Eugen
On 8 Sep, 13:49, Eugen Artus <eugen.ar...@arcor.de> wrote:
> Hi Rune! > > > The FT and the DFT can be linked, but then you have to > > apply the sampling theorem, map the frequency response > > of the RC cirquit to Z-transform domain by using a > > BiLinear Transform (BLT), and so on. > > Ok. Would you be so kind to give a brief outline of the necessary steps to > solve this particular problem? Of course, any recommendations regarding > literature or websites are very welcome, too.
What problem? If you want to study the RC cirquit in question, use the continuous-time form of the FT, not the DFT. That is, evaluate the Laplace transform H(s) on the imaginary axis, and map the poles and/or zeros in s domain. As for the BLT, it is used when one wants to design a discrete-time filter from an analog prototype. There are plenty of details to consider, like nonlinearities in the mapping of frequencies. The imaginary axis in s domain is mapped to the unit circle in z domain. You alos have to deal with sampling rates etc. In essence: 1) The results in z domain are different from the results in s domain 2) One does the mapping for very specific reasons As I understand your post, you want to study the RC circuit. If correct, there is no point in going through the motions to map to z domain. If you want to look into these things, check out an intermediate level text on DSP; the intro texts might not get into the details of these matters. I am most familiar with the book by Proakis and Manolakis, but the books by Oppenheim and Schafer (they have co-authored several) are also popular. Rune
Rune Allnor wrote:

   ...

> Doesn't matter. I used the numbers as arguments to the DFT. > Your point seems to be that in case 1, my use of the DFT > is wrong because no more numbers exist in the data set than > those I feed to the DFT. In case 2 you seem to think that > using the DFT is correct, because of the data items I *don't* > feed to the DFT. In this last case, that argument turns > straight and all of a sudden the DFT is wrong because of the > data points I *don't* feed to the DFT. > > Would you ever present that sort of argument to a paying > customer? If so, would you be surprised if the same paying > customer called in people to express a 2nd, a 3rd and > maybe even a 4th opinion? > >> But my overall explanation is that you are trying to make my point for >> me, by finding numerous examples of randomly applying the DFT to vectors >> of numbers in ways that are sometimes potentially meaningful and >> sometimes not. > > The result of the DFT always 'means' the same thing: How > a given data set can be expressed in terms of a set of > complex-valued basis vectors in an N-dimensional vector space. > >> But I can't for the life of me explain why you are doing this, and why >> you couch it in language that implies you are doing the opposite. > > Again, you are a smart guy. You are amongst the very few > people here that > > a) are smart enough to see that the DFT is nothing more > than a basis shift transform of the data actually > presented to the algorithm. > b) pragmatic enough to actually change your opinions once > you see that you have been wrong. > > Over the past few weeks I have come to realize that people > I used to respect for their knowledge and skills, suffer > from this DFT delution. This was too good an opportunity to > test out if these people really are as stupid as they appear.
I don't think anyone here claims that a DFT is legitimate only with periodic data. What is claimed is that the operation on a finite sequence gives the same result as operating on a repeated duplication of that sequence, or on a circularly shifted version of it. You ably demonstrated that in this thread. There are applications where this property matters, and where ignoring it leads to error. Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Eugen Artus wrote:
> Hi Rune! > >> The FT and the DFT can be linked, but then you have to >> apply the sampling theorem, map the frequency response >> of the RC cirquit to Z-transform domain by using a >> BiLinear Transform (BLT), and so on. > > Ok. Would you be so kind to give a brief outline of the necessary steps to > solve this particular problem? Of course, any recommendations regarding > literature or websites are very welcome, too. > > Thank you!
Sampling is useful only for bandlimited signals. An exponential decay is not bandlimited. There are two standard ways to model the continuous (s) domain as discrete. The (to me) more intuitively obvious is "impulse invariance" which models an analog circuit's impulse response as well as a sampled system can. The bilinear transform that Rune mentioned is more complicated (frequency warping and all that) but generally gives more satisfactory results. At http://www.bores.com/courses/intro/index.htm you canead about both. If x[n] are succesive outputs and y[n] are succesive outputs, an exponential decay can be modeled as y[n]=a*x[n]+(1-a)*y[n-1]. When a is small, the time constant is long. 0<a<1 Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
On Tue, 08 Sep 2009 03:55:50 -0700, Rune Allnor wrote:

> On 7 Sep, 23:21, Tim Wescott <t...@seemywebsite.com> wrote: >> On Mon, 07 Sep 2009 11:21:25 -0700, Rune Allnor wrote: >> > On 7 Sep, 19:44, Tim Wescott <t...@seemywebsite.com> wrote: >> >> On Mon, 07 Sep 2009 09:48:56 -0700, Rune Allnor wrote: >> >> > On 7 Sep, 17:36, Tim Wescott <t...@seemywebsite.com> wrote: >> >> >> On Mon, 07 Sep 2009 08:30:10 -0700, Rune Allnor wrote: >> >> >> > On 7 Sep, 15:13, julius <juli...@gmail.com> wrote: >> >> >> >> On Sep 7, 8:00&nbsp;am, Rune Allnor <all...@tele.ntnu.no> wrote: >> >> >> >> >> > On 7 Sep, 13:38, Eugen Artus <eugen.ar...@arcor.de> wrote: >> >> >> >> >> > > Hi! >> >> >> >> >> > > Suppose there is resistor R and a capacitor C connected in >> >> >> >> > > series. A voltage U_0 is applied at time t=0. The current >> >> >> >> > > in the time domain is then >> >> >> >> >> > > I(t) = U_0/R * e^(-t/RC) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(1) >> >> >> >> >> > > Taking a Laplace transform and substituting s by >> >> >> >> > > j*2*\pi*f, I get the frequency domain current: >> >> >> >> >> > > I(f) = U_0*C/(j*2*\pi*f*R*C+1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(2) >> >> >> >> >> > > Now the problem: I defined values for U_0, R and C, >> >> >> >> > > calculated the time domain signal by Eq. 1 and transformed >> >> >> >> > > it by DFT (using the Python function numpy.fft.rfft). >> >> >> >> > > Then, I normalized the result by multiplying with 2/N, >> >> >> >> > > except the first and the last sample, which were >> >> >> >> > > multiplied with 1/N. N is the number of samples of the >> >> >> >> > > time signal. >> >> >> >> >> > > A comparison with the signal predicted by Eq. 2 shows a >> >> >> >> > > significant difference. What am I doing wrong? >> >> >> >> >> > The error you make is that you think that the DFT and the >> >> >> >> > Fourier Transform are the seame operation. In fact, they are >> >> >> >> > fundamentally different: >> >> >> >> >> > - The FT works with infinitely long, continuous-time >> >> >> >> > signals. - The DFT works with dicrete-time data of finite >> >> >> >> > length. >> >> >> >> >> > These differences have a couple of consequences, like >> >> >> >> >> > - The DFT produces a discrete, finite-length spectrum - The >> >> >> >> > FT produces a continuous, infinitely wide spectrum >> >> >> >> >> > The FT and the DFT can be linked, but then you have to apply >> >> >> >> > the sampling theorem, map the frequency response of the RC >> >> >> >> > cirquit to Z-transform domain by using a BiLinear Transform >> >> >> >> > (BLT), and so on. >> >> >> >> >> > Rune >> >> >> >> >> To add to Rune's comment, the DFT operates on discrete, >> >> >> >> finite, PERIODIC time series and produces a discrete, finite, >> >> >> >> PERIODIC frequency series. >> >> >> >> >> One way to get around this is to use zero padding judiciously. >> >> >> >> > Ah. Here are some data I have lying around: >> >> >> >> > x = [1,2,3,4,5,6,7,8,9]; >> >> >> >> > Those numbers are all there is to this data set. No more. No >> >> >> > less. >> >> >> >> > Remind me, where is that period? >> >> >> >> No where. &nbsp;Which is why you should use the DFT judiciously on >> >> >> this sequence, because the DFT implicitly assumes a periodic, >> >> >> evenly sampled sequence and your sequence is not periodic. >> >> >> > ... so you seem to mean that the DFT can not be used on this >> >> > sequence? If so, what does the numbers >> >> >> > X = fft(x) = >> >> > [ 45.0000 >> >> > &nbsp; -4.5000 +12.3636i >> >> > &nbsp; -4.5000 + 5.3629i >> >> > &nbsp; -4.5000 + 2.5981i >> >> > &nbsp; -4.5000 + 0.7935i >> >> > &nbsp; -4.5000 - 0.7935i >> >> > &nbsp; -4.5000 - 2.5981i >> >> > &nbsp; -4.5000 - 5.3629i >> >> > &nbsp; -4.5000 -12.3636i] >> >> >> > signify? >> >> >> Well, if the sequence is taken from a program written in C, and if >> >> the variable in question is an enumeration of fruit, and if the >> >> mapping between meaning and numbers goes >> >> >> 1: apples >> >> 2: oranges >> >> 3: grapes >> >> 4: kumquats >> >> 5: peaches >> >> 6: banannas >> >> 7: grapefruit >> >> 8: rose hips >> >> 9: mangoes, >> >> >> then the sequence you present means Absolutely Nothing. &nbsp;That >> >> doesn't mean you can't take the DFT of it, just that you have chosen >> >> a mathematical operation that means nothing to the data at hand. >> >> > The data are given. >> >> Why are you playing games today? &nbsp;You've given no data, just some >> numbers. > > Those numbers are the data. Numbers are the only kinds of data you will > ever get within the realm of DSP. > >>&nbsp;Without explaining the meaning of the numbers they are -- well >> -- meaningless. &nbsp;That's my whole point. &nbsp;To continue is just to blow >> smoke in hopes that my point will be obscured. > > I know you are very smart. I suspect you even understand how ridiculous > the "The DFT requires periodic data" argument is. Of course, considering > that almost everybody else here have bought into the delusion I can > understand that you do not want to break ranks with the rest of the > poeple here. > > But again, you are smart enough to see my point. And I'm pretty sure you > do see it.
I'd accept that I'm smart enough to see your point, except that I'm clearly (at least it's clear to me!) confused. Perhaps it's that pragmatism you accuse me of (more on that later). But for now you'll have to accept that I'm at least partially dense.
>> > Now, incidentially, I have another data series lying around: >> >> > y = [...,8,9,1,2,3,4,5,6,7,8,9,1,2,...] >> >> > which is periodic ad infinitum with one period yp given as >> >> > yp = [1,2,3,4,5,6,7,8,9]. >> >> > The DFT of this sequence is >> >> > Y = fft(yp) = >> > [ 45.0000 >> > &nbsp; -4.5000 +12.3636i >> > &nbsp; -4.5000 + 5.3629i >> > &nbsp; -4.5000 + 2.5981i >> > &nbsp; -4.5000 + 0.7935i >> > &nbsp; -4.5000 - 0.7935i >> > &nbsp; -4.5000 - 2.5981i >> > &nbsp; -4.5000 - 5.3629i >> > &nbsp; -4.5000 -12.3636i] >> >> > I can't tell form the result of the DFT computation that there is any >> > difference between x and y. Can you? >> >> Not from the result of the DFT, but because the DFT can be interpreted >> as being exactly correct when applied to periodic, sampled data, then >> it can be interpreted as a harmonic decomposition of the original >> series. > > The DFT can not interpret anything, because the DFT 'sees' a ninite set > of numbers, and does its thing with those numbers that happen to be > presented to it. No more. No less. > >> > Of course, there is also the pre- annd post-zero padded infinite >> > sequence >> >> > z = [...,0,0,0,1,2,3,4,5,6,7,8,9,0,0,0] >> >> > with nonzero segment zz given as >> >> > zz = [1,2,3,4,5,6,7,8,9]. >> >> > Not surprisingly, the DFT of this segment is >> >> > Z = fft(zz) = >> > [ 45.0000 >> > &nbsp; -4.5000 +12.3636i >> > &nbsp; -4.5000 + 5.3629i >> > &nbsp; -4.5000 + 2.5981i >> > &nbsp; -4.5000 + 0.7935i >> > &nbsp; -4.5000 - 0.7935i >> > &nbsp; -4.5000 - 2.5981i >> > &nbsp; -4.5000 - 5.3629i >> > &nbsp; -4.5000 -12.3636i] >> >> > Not even here do I see any difference with either X or Y. >> >> > Could you please explain this? >> >> > Rune >> >> And here the DFT is a very crude approximation of what's 'really' going >> on with the sequence; the correct way to get a spectrum of this one >> would be with a Fourier transform. > > Doesn't matter. I used the numbers as arguments to the DFT. Your point > seems to be that in case 1, my use of the DFT is wrong because no more > numbers exist in the data set than those I feed to the DFT. In case 2 > you seem to think that using the DFT is correct, because of the data > items I *don't* feed to the DFT. In this last case, that argument turns > straight and all of a sudden the DFT is wrong because of the data points > I *don't* feed to the DFT. > > Would you ever present that sort of argument to a paying customer? If > so, would you be surprised if the same paying customer called in people > to express a 2nd, a 3rd and maybe even a 4th opinion?
I would present an expanded version of that sort of argument to a paying customer, yes -- in fact I have done that sort of thing before. I'd expect to meet opposition because of inertia of thought, and that's why I'd expand it. But if it were necessary (e.g. to convince a customer that a certain approach needed to be taken) I'd do it. What my argument boils down to is that for the analysis to be meaningful in addition to being mathematically correct then (a) the numbers have to represent something that's useful to have broken down into frequency components (there's that danged pragmatism!) and (b) the data set that ends up getting transformed -- _after_ windowing, etc. -- has to be a reasonable approximation of whatever you started with. I see these two conditions violated all the time; sometimes by folks who should know better, sometimes by folks who have somehow gotten the notion that "DSP == FFT" and feel that they can get something useful by blind application of the FFT operation.
>> But my overall explanation is that you are trying to make my point for >> me, by finding numerous examples of randomly applying the DFT to >> vectors of numbers in ways that are sometimes potentially meaningful >> and sometimes not. > > The result of the DFT always 'means' the same thing: How a given data > set can be expressed in terms of a set of complex-valued basis vectors > in an N-dimensional vector space.
Absolutely true, in a purely mathematical sense. But as I tried to point out in my 'fruity' example, the resulting set of basis vectors may have absolutely no meaning at all with respect to the problem at hand. So like any other mathematical analysis tool one must ask oneself (or one's collaborators) what level of relevance the tool has to the problem you're trying to solve. (Note that I can't think of any example of any data set that's the result of evenly sampling and measuring some quantity in time, space, or any other meaningful dimension where you wouldn't find _some_ use in doing some spectral analysis, although I can think of a few [i.e. spread spectrum] where an FFT is of limited use).
>> But I can't for the life of me explain why you are doing this, and why >> you couch it in language that implies you are doing the opposite. > > Again, you are a smart guy. You are amongst the very few people here > that > > a) are smart enouhg to see that the DFT is nothing more > than a basis shift transform of the data actually presented to the > algorithm. > b) pragmatic enough to actually change your opinions once > you see that you have been wrong. > > Over the past few weeks I have come to realize that people I used to > respect for their knowledge and skills,
Perhaps you're just getting cranky because it's fall and the light's failing? I've always found that really working to equate the meaning of what comes out of a Fourier transform to the 'real world' is mind- bending; what looks like a mountain in Fourier space might be a symphony in temporal space. So I can't blame people for not being able to wrap their brains around this stuff without a lot of effort -- although when _I'm_ cranky I'm more likely to.
> suffer from this DFT delusion. > This was too good an opportunity to test out if these people really are > as stupid as they appear.
I think "delusion" is too strong a word. 'Limited view', perhaps. I'll assert right here that it is correct to say that if you're taking the spectra of a physical signal in the sense of a Fourier transform then the DFT _itself_ is only _exact_ for exactly periodic (and sampled) signals (or ones on a circular domain -- if you can find them). But when I say "not exact" I certainly don't mean "not useful" or "inappropriate", at least not without more data. The point that I try to make in the use of the DFT (or 'FFT' for the "DSP == FFT and I don't know what this DFT thing is" folks) is that you start from a real-world signal that is infinite in extent, and you truncate it (forget sampling for the moment). That truncated signal is but an approximation of the actual signal. Then you perform a DFT on it. If you blindly expect the output of the DFT to be exactly representative of the characteristics of the real signal then you are leading yourself into error -- not because the DFT is an approximation, but because the only possible _input_ to the DFT is an approximation for all but a narrow class of signals, a class into which most real-world signals do not fall. Where I see people falling into error in the use of the DFT isn't the line of Matlab code that says spectrumX = fft(x); it's the (often implicit) assumption that their captured vector of samples 'x' actually matches some physical reality that they want to test. So while I have a good idea of where _I_ want to go, I'm still pretty unclear on where you want to lead me. -- www.wescottdesign.com
On 8 Sep, 17:32, Jerry Avins <j...@ieee.org> wrote:
> Rune Allnor wrote: > > &#2013266080; &#2013266080;... > > > > > > > Doesn't matter. I used the numbers as arguments to the DFT. > > Your point seems to be that in case 1, my use of the DFT > > is wrong because no more numbers exist in the data set than > > those I feed to the DFT. In case 2 you seem to think that > > using the DFT is correct, because of the data items I *don't* > > feed to the DFT. In this last case, that argument turns > > straight and all of a sudden the DFT is wrong because of the > > data points I *don't* feed to the DFT. > > > Would you ever present that sort of argument to a paying > > customer? If so, would you be surprised if the same paying > > customer called in people to express a 2nd, a 3rd and > > maybe even a 4th opinion? > > >> But my overall explanation is that you are trying to make my point for > >> me, by finding numerous examples of randomly applying the DFT to vectors > >> of numbers in ways that are sometimes potentially meaningful and > >> sometimes not. > > > The result of the DFT always 'means' the same thing: How > > a given data set can be expressed in terms of a set of > > complex-valued basis vectors in an N-dimensional vector space. > > >> But I can't for the life of me explain why you are doing this, and why > >> you couch it in language that implies you are doing the opposite. > > > Again, you are a smart guy. You are amongst the very few > > people here that > > > a) are smart enough to see that the DFT is nothing more > > &#2013266080; &#2013266080;than a basis shift transform of the data actually > > &#2013266080; &#2013266080;presented to the algorithm. > > b) pragmatic enough to actually change your opinions once > > &#2013266080; &#2013266080;you see that you have been wrong. > > > Over the past few weeks I have come to realize that people > > I used to respect for their knowledge and skills, suffer > > from this DFT delution. This was too good an opportunity to > > test out if these people really are as stupid as they appear. > > I don't think anyone here claims that a DFT is legitimate only with > periodic data.
From a previpouis post, http://groups.google.no/group/comp.dsp/msg/4d0095164f78bcfc?hl=no pisted by Julius: "To add to Rune's comment, the DFT operates on discrete, finite, PERIODIC time series and produces a discrete, finite, PERIODIC frequency series." How is it possible to read the above and *not* get the impression that Jusius makes exatly that claim?
> What is claimed is that the operation on a finite > sequence gives the same result as operating on a repeated duplication of > that sequence, or on a circularly shifted version of it. You ably > demonstrated that in this thread.
I stand corrected. There are more people than Tim around that has the potential to read and understand an argument, and also change their minds. Thanks, Jerry. My your post means that my faith in Homo Sapiens as an occasionally intelligent creature didn't shatter completely. Quite yet. Rune
On Mon, 07 Sep 2009 13:38:39 +0200, Eugen Artus wrote:

> Hi! > > Suppose there is resistor R and a capacitor C connected in series. A > voltage U_0 is applied at time t=0. The current in the time domain is > then > > I(t) = U_0/R * e^(-t/RC) (1) > > Taking a Laplace transform and substituting s by j*2*\pi*f, I get the > frequency domain current: > > I(f) = U_0*C/(j*2*\pi*f*R*C+1) (2) > > Now the problem: I defined values for U_0, R and C, calculated the time > domain signal by Eq. 1 and transformed it by DFT (using the Python > function numpy.fft.rfft). Then, I normalized the result by multiplying > with 2/N, except the first and the last sample, which were multiplied > with 1/N. N is the number of samples of the time signal. > > A comparison with the signal predicted by Eq. 2 shows a significant > difference. What am I doing wrong?
(sorry for getting off on the tangent without answering your real question). What you are doing wrong is trying to answer a continuous-time question with sampled-time analysis tools. Would you drive a nail with a screwdriver? Screw in a screw with a wrench? Tighten a nut with a hammer? Screws, nuts and nails are all fasteners; hammers, screwdrivers and wrenches are all tools to make fasteners work, yet use the wrong tool for a perfectly good fastener and you'll do no good at all. Similarly, the Laplace transform is the right tool for analyzing continuous-time ordinary linear differential equations, which is what you're working with. Keep your analysis in the Laplace domain, and things should work well. If you're trying to analyze what happens if you sample the result of the continuous-time operation then say so, and someone will point out how to do that part. -- www.wescottdesign.com