Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/23/07 07:31
Read: times


 
#146050 - If you're really curious ...
Responding to: ???'s previous message
... about all the glorious details, getting your hands on the book I mentioned earlier might be a good idea. Maybe your local library has a copy or can get one via inter-library loan ?

What is 'a' or in Steve's case 'k'?,

In this form, a is a function of the time constant of the simulated exponential curve. Usually, in-depth analysis of such filter functions is done in the z domain, but if you're just trying to stabilize a DC reading, then knowing the frequency response of the whole thing probably isn't necessary.

clearly if a=1 then your first term vanishes, if a = 0 then your last term vanishes??

Yes. If a = 1, then the output will be equal to the input. If a = 0, then the filter output will be constant. The closer a is to 0, the larger the time constant will be. Usually, you'll have a in the range of 0.05 to 0.25. Beware, though, that you'll eventually (as a gets smaller) run into problems with the numerics if you use fixed-point math. Eventually, you'll have to do the calculations "inside" the filter at a higher precision (i.e. with more bits) than your input and output values will have, e.g. you'll have to calculate the results with 32 bits if your input/output are 16 bits.


How would I adjust sample time and integration time?,

The latter by modifying a. By sample time, do you mean the sampling period of the ADC ?

Usually, these difference equations are analyzed with a "normalized" frequency instead of actual frequencies in Hz. The normalized frequency is a dimensionless number, f/(0.5 * f_sampling).

I assume 'x' is your input raw value?
'y(n)' is previous pass modified sample?
'y(n+1) is current pass modified sample?


Correct.

This is kind of where the z transformation comes in. In _very_
(extremely) simplified terms, the z transformation expresses
time-shifts by multiplication with powers of z. So if one of the
variables in a z-domain equation is multiplied by z^-1, this
means the value of this variable one sample in the past, z^-2
two samples in the past, z^1 one sample in the future, and so on.

Using this on the difference equation:

y(n) = (1 - a) * y(n-1) + a * x(n-1)
transformed into z domain:
Y = (1 - a) * z^-1 * Y + a * X
Y + (a - 1) * Y * z^-1 = a * X
Y * (1 + (a - 1) * z^-1) = a * X
Y / X = a / (1 + (a - 1) * z^-1)


The last line is the so-called transfer function in the z domain.
The frequency response can now be calculated by substituting e^(j*omega) for z (omega being normalized to omega_sampling).

(Unfortunately, it's a bit hard to post all the formulas without using images)

Okay, my first order cr equation looks like this:
E=Vc+cr.dVc/dt....charging
E=Vc-cr.dVc/dt....discharging


The homogenous part of the differential equation should be the same no matter whether you're charging or discharging the capacitor, since the charging/discharging is expressed in the particular part of the equation.

How to get from the differential to the difference equation by trying to solve the differential equation numerically is already described in one of my earlier postings.

The are other ways of getting from other domains to a difference equation (for example the bilinear transformation, which transforms a transfer function in the Laplace domain to a transfer function in the z domain).

List of 64 messages in thread
TopicAuthorDate
ADC last digit stability            01/01/70 00:00      
   DVM            01/01/70 00:00      
      DVM's only 10 bits?            01/01/70 00:00      
         Frequency response            01/01/70 00:00      
            Typically twice or more the sampling frequency            01/01/70 00:00      
               Missing the point            01/01/70 00:00      
   You usually don\'t _want_ a stable last digit.            01/01/70 00:00      
      Result            01/01/70 00:00      
         Hm.            01/01/70 00:00      
      Averaging/DSP/FIR filters            01/01/70 00:00      
         Math lecture ?            01/01/70 00:00      
            Can't use average-too slow            01/01/70 00:00      
               Analysis            01/01/70 00:00      
               already stated            01/01/70 00:00      
               Derivation            01/01/70 00:00      
                  The nitty gritty stuff            01/01/70 00:00      
                     Simulate using a spreadsheet            01/01/70 00:00      
                        Hi Russ and thanks for that            01/01/70 00:00      
                           My spreadsheet vs. your spreadsheet            01/01/70 00:00      
                              Unit test !            01/01/70 00:00      
                     As I said...            01/01/70 00:00      
                        Calibration?            01/01/70 00:00      
                           Horsefeathers            01/01/70 00:00      
                              Longs?            01/01/70 00:00      
                                 A long is more "accurate" than a float.            01/01/70 00:00      
                                    Yes it is, but....            01/01/70 00:00      
                                       _Known_ transfer functions.            01/01/70 00:00      
                                          FP pitfalls            01/01/70 00:00      
                                             The compiler isn't going to take care of that.            01/01/70 00:00      
                                                Mantissa fields            01/01/70 00:00      
                                                   Misunderstandings ?            01/01/70 00:00      
                                                      Adding FP's accurately            01/01/70 00:00      
                                 can you not read ?            01/01/70 00:00      
                           Nonsense ...            01/01/70 00:00      
                              Calculator?            01/01/70 00:00      
                     If you're really curious ...            01/01/70 00:00      
                        Climax time            01/01/70 00:00      
                           OOPS!!....            01/01/70 00:00      
                           Equations            01/01/70 00:00      
                              Quantisation            01/01/70 00:00      
                                 Works in unsigned integer, too:            01/01/70 00:00      
                                    Abstract?            01/01/70 00:00      
                                       Useful abstractions.            01/01/70 00:00      
                                          Nice talking with you, Christoph.            01/01/70 00:00      
                           What are the actual requirements ?            01/01/70 00:00      
                              re filters            01/01/70 00:00      
                              And moving forward            01/01/70 00:00      
               You can not due to Dither            01/01/70 00:00      
         Clueless ?            01/01/70 00:00      
            Just dump the LSB            01/01/70 00:00      
               Don't forget proper rounding.            01/01/70 00:00      
            Speaking of DSP            01/01/70 00:00      
         Fluke stability            01/01/70 00:00      
   Oh yes they do!            01/01/70 00:00      
   my take on this            01/01/70 00:00      
      Walk, don't run            01/01/70 00:00      
         :)            01/01/70 00:00      
      Hello Erik            01/01/70 00:00      
         have fun, Jason            01/01/70 00:00      
            I am having fun            01/01/70 00:00      
               Ok, you are aware of this            01/01/70 00:00      
                  He's learning            01/01/70 00:00      
                  Assumptions            01/01/70 00:00      
                     and I ...            01/01/70 00:00      

Back to Subject List