DSPRelated.com
Forums

Delay in FIR Differentiators: Contd. from VMSK are the claims genuine

Started by I. R. Khan February 11, 2004
Hi all,

I shall try to make the things clear with an example:

Suppose we are having a nice digital thermometer in an office, which
measures temperature with an interval of one hour and stores three readings
at a time. Now at 6 pm every one is asked to calculate the rate at which
temperature is changing at 6 pm.

One guy uses t'[6]=(3t[6]-4t[5]+t[4])/2, and gets the result immediately.
i.e., without any delay.
Another guy complains that the data is insufficient for his formula and
waits till 7 pm and gets the result as t'[6]=(t[7]+0t[6]-t[5])/2. i.e. at 7
pm he got the rate at which temperature was changing at 6 pm. i.e., with a
delay of one hour, i.e., one sample delay.
Third fellow has his own formula and waits till 8 pm to calculate
t'[6]=(-3t[8]+4t[7]-t[6])/2. So he result comes with delay of two hours,
i.e., 2 samples delay.

The three men were using backward, central and forward difference
approximations respectively.
===========================

As Clay mentioned earlier, (N-1)/2 is used to calculate delay for filters
with (anti) symetric impulse responses. In the above example, only CDAs are
symmetric, others are not. For symmetric differentiators, output corresponds
to the derivative at the time, at which central sample was taken. For BDA,
output gives derivative at the time at which latest sample was taken, and
for FDAs output gives derivative at time at which oldest sample was taken.
So for BDA, delay is zero, while for FDAs, it is double than that for CDAs.
==========================

y[k] = x[k]-x[k-1] apperas to be symmetric filter but it is not. Look at the
index of y. Let me write it in this form y[k] = 0x[k+1]+x[k]-x[k-1]; clearly
{0,1,-1} is not a symmetric filter.
However y[k-1/2] = x[k]-x[k-1] is symmetyric and has half sample delay,
again look at the indices of y and x. This can be rewritten as y[k] =
x[k+1/2]-x[k-1/2].
In the above example the setting of thermometer can be changed and
derivative can be found by t'[6] = (t[6.5]-t[5.5])/2, i.e., with a delay of
half hour or half sample.
===========================

Memory should not be confused with delay. y[k] = x[k]-x[k-1] needs memory to
store x[k-1] but y[k] is not delayed. Plot y and x on the same axis, the
line joining its ends will always be exactly parallel to the verical axis.
You can however question its accuracy. Of course it is less accurate than
CDA, especially if you move a little away from w = 0.
===========================

An example was given that for y[k] = k^2, y'[k] is half sample delayed. In
fact it is not delayed. The error in calculation due to limitations of this
differentiator makes it look like as if output is delayed by half sample. It
can be seen that there will be no delay if 3 tap BDA is used, which is given
in above example.

Let me explain it with figures:

y[k] = k^2;
k = 0,1,2,3,4,...
y[k]=0,1,4,9,16,...
ideal y'[4]=2*4=8
using BDA: y'[4]=(3y[4]-4y[3]+y[2])/2=(48-36+4)/2=8; not delayed at all
using CDA: y'[4]=(y[5]-y[3])/2; insufficient data at t=4, got to wait till
next sample arrives.

Rick, example of Sine wave will have other errors inherent in BDAs, and it
will be difficult to prove anything, so better we stick to polynomials for
the time being.
===========================

An interesting thing, not related to this thread, is that CDAs are being
used much longer even before the birth of DSP. People found coefficients of
MAXFLAT (or maximally linear to be precise) FIR differentiators using
different ways, but they were actually the same as CDAs. Even-length MAXLIN
differentiators (one example y[k-1/2] = (x[k]-x[k-1])/2) can also be derived
from Taylor series, and because these are wideband filters (unlike type III
filters or CDAs), they can be transformed to other MAXFLAT filters including
low/high pass and band pass/stop filters etc. So in fact all MAXFLAT filters
are kind of extension of Taylor series. If relationship is found between
MAXFLAT and other types of filters (minimax etc), then whole theory of
digital filtering can be based on Taylor series.

Regards,
Ishtiaq.

I. R. Khan wrote:

> Hi all, > > I shall try to make the things clear with an example: > > Suppose we are having a nice digital thermometer in an office, which > measures temperature with an interval of one hour and stores three readings > at a time. Now at 6 pm every one is asked to calculate the rate at which > temperature is changing at 6 pm. > > One guy uses t'[6]=(3t[6]-4t[5]+t[4])/2, and gets the result immediately. > i.e., without any delay.
The calculated result is immediately produced, but it applies to the past. It is, effectively, the secant slope with the current reading as the most up-to-date point. It is a good estimate of the tangent slop at some time in the past.
> Another guy complains that the data is insufficient for his formula and > waits till 7 pm and gets the result as t'[6]=(t[7]+0t[6]-t[5])/2. i.e. at 7 > pm he got the rate at which temperature was changing at 6 pm. i.e., with a > delay of one hour, i.e., one sample delay.
Although late, it is more accurate. Often, promptness is more important than accuracy. Neither urgent need for the prompt result nor wishful thinking make it accurate.
> Third fellow has his own formula and waits till 8 pm to calculate > t'[6]=(-3t[8]+4t[7]-t[6])/2. So he result comes with delay of two hours, > i.e., 2 samples delay.
This slope is no more accurate than the first. It is a secant slope whose first point is at the desired time and whose last point is two hours later. It has maximum delay and shares honors for worst accuracy.
> The three men were using backward, central and forward difference > approximations respectively. > =========================== > > As Clay mentioned earlier, (N-1)/2 is used to calculate delay for filters > with (anti) symetric impulse responses. In the above example, only CDAs are > symmetric, others are not. For symmetric differentiators, output corresponds > to the derivative at the time, at which central sample was taken. For BDA, > output gives derivative at the time at which latest sample was taken, and > for FDAs output gives derivative at time at which oldest sample was taken. > So for BDA, delay is zero, while for FDAs, it is double than that for CDAs.
You misconstrue "delay". It has nothing to do with the time between calculating and delivering the result. It has to do instead with the time that calculated result applies to relative to the time at which a calculation can be made. BDA immediately gives information about the past. How can it be otherwise? only past information is available.
> ========================== > > y[k] = x[k]-x[k-1] apperas to be symmetric filter but it is not. Look at the > index of y. Let me write it in this form y[k] = 0x[k+1]+x[k]-x[k-1]; clearly > {0,1,-1} is not a symmetric filter. > However y[k-1/2] = x[k]-x[k-1] is symmetyric and has half sample delay, > again look at the indices of y and x. This can be rewritten as y[k] = > x[k+1/2]-x[k-1/2]. > In the above example the setting of thermometer can be changed and > derivative can be found by t'[6] = (t[6.5]-t[5.5])/2, i.e., with a delay of > half hour or half sample. > =========================== > > Memory should not be confused with delay. y[k] = x[k]-x[k-1] needs memory to > store x[k-1] but y[k] is not delayed. Plot y and x on the same axis, the > line joining its ends will always be exactly parallel to the verical axis. > You can however question its accuracy. Of course it is less accurate than > CDA, especially if you move a little away from w = 0.
y[k] is not delayed between calculation and delivery. Some of the terms used to calculate it are delayed between acquisition and the calculation. x[k-1] is delayed when it enters the calculation. Calculating with data from the past implies delay. That can be offset with data from the future when you can get it.
> ===========================
[repetition snipped] Jerry -- Engineering is the art of making what you want from things you can get. -----------------------------------------------------------------------
> > One guy uses t'[6]=(3t[6]-4t[5]+t[4])/2, and gets the result
immediately.
> > i.e., without any delay. > > The calculated result is immediately produced, but it applies to the past. > It is, effectively, the secant slope with the current reading as the most > up-to-date point. It is a good estimate of the tangent slop at some time > in the past.
Jerry look at t'[6], it means rate of change of temperature at 6 pm. Accuracy is another issue.
> > Another guy complains that the data is insufficient for his formula and > > waits till 7 pm and gets the result as t'[6]=(t[7]+0t[6]-t[5])/2. i.e.
at 7
> > pm he got the rate at which temperature was changing at 6 pm. i.e., with
a
> > delay of one hour, i.e., one sample delay. > > Although late, it is more accurate.
Agreed. In fact mentioned in my post.
> You misconstrue "delay". It has nothing to do with the time between > calculating and delivering the result. It has to do instead with the time > that calculated result applies to relative to the time at which a > calculation can be made.
Sure, I agree. Again look at t'[6], it means derivative at 6pm.
>BDA immediately gives information about the past. > How can it be otherwise? only past information is available.
Not only past. Past and current in fact. It is based on Taylor series. From past and current data, you calculate current rate of change. Any Numerical Methods book will explain it.
> > > > Memory should not be confused with delay. y[k] = x[k]-x[k-1] needs
memory to
> > store x[k-1] but y[k] is not delayed. Plot y and x on the same axis, the > > line joining its ends will always be exactly parallel to the verical
axis.
> > You can however question its accuracy. Of course it is less accurate
than
> > CDA, especially if you move a little away from w = 0. > > y[k] is not delayed between calculation and delivery. Some of the terms > used to calculate it are delayed between acquisition and the calculation. > x[k-1] is delayed when it enters the calculation. Calculating with data > from the past implies delay. That can be offset with data from the future > when you can get it. >
Jerry please look at the indices of y and x in each equation I mentioned in previous post. What you are saying is all correct, except that you insist y[k]=x[k]-x[k-1] gives derivative at some point other than k, while this equation expalins it very clearly that it is k at which y is calculated. Regards, Ishtiaq.
I. R. Khan wrote:

>>>One guy uses t'[6]=(3t[6]-4t[5]+t[4])/2, and gets the result > > immediately. > >>>i.e., without any delay. >> >>The calculated result is immediately produced, but it applies to the past. >>It is, effectively, the secant slope with the current reading as the most >>up-to-date point. It is a good estimate of the tangent slop at some time >>in the past. > > > Jerry look at t'[6], it means rate of change of temperature at 6 pm. > Accuracy is another issue. > > >>>Another guy complains that the data is insufficient for his formula and >>>waits till 7 pm and gets the result as t'[6]=(t[7]+0t[6]-t[5])/2. i.e. > > at 7 > >>>pm he got the rate at which temperature was changing at 6 pm. i.e., with > > a > >>>delay of one hour, i.e., one sample delay. >> >>Although late, it is more accurate. > > > Agreed. In fact mentioned in my post. > > > >>You misconstrue "delay". It has nothing to do with the time between >>calculating and delivering the result. It has to do instead with the time >>that calculated result applies to relative to the time at which a >>calculation can be made. > > > Sure, I agree. Again look at t'[6], it means derivative at 6pm. > > > >>BDA immediately gives information about the past. >>How can it be otherwise? only past information is available. > > > Not only past. Past and current in fact. It is based on Taylor series. From > past and current data, you calculate current rate of change. Any Numerical > Methods book will explain it. > > > >>>Memory should not be confused with delay. y[k] = x[k]-x[k-1] needs > > memory to > >>>store x[k-1] but y[k] is not delayed. Plot y and x on the same axis, the >>>line joining its ends will always be exactly parallel to the verical > > axis. > >>>You can however question its accuracy. Of course it is less accurate > > than > >>>CDA, especially if you move a little away from w = 0. >> >>y[k] is not delayed between calculation and delivery. Some of the terms >>used to calculate it are delayed between acquisition and the calculation. >>x[k-1] is delayed when it enters the calculation. Calculating with data >>from the past implies delay. That can be offset with data from the future >>when you can get it. >> > > > Jerry please look at the indices of y and x in each equation I mentioned in > previous post. What you are saying is all correct, except that you insist > y[k]=x[k]-x[k-1] gives derivative at some point other than k, while this > equation expalins it very clearly that it is k at which y is calculated. > > Regards, > Ishtiaq.
If the slope is increasing, the calculated result will be too small. If the slope is decreasing, the calculated result will be too large. The calculated slope will be the actual slope at some time in the past. That's what is meant by delay. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
> If the slope is increasing, the calculated result will be too small. > If the slope is decreasing, the calculated result will be too large. > The calculated slope will be the actual slope at some time in the past. > That's what is meant by delay.
Jerry, will be explain a bit more? for y[k] = k^2, slope is 2k and is increasing, while for y[k] = - k^2, slope -2k is decreasing. How does it affect the result? Did you give some thought to the index thing? Less or more accurate is another issue, result of BDA applies to the time at which calculation is being done. It can be proved very easily: f(x0-h) = f(x0) - h f'(x0) + O(h^2) f'(x0) = (f(x0)-f(x0-h))/h + O(h) Look at the index x0 on both sides of the equation. Ishtiaq.
I. R. Khan wrote:

>>If the slope is increasing, the calculated result will be too small. >>If the slope is decreasing, the calculated result will be too large. >>The calculated slope will be the actual slope at some time in the past. >>That's what is meant by delay. > > > Jerry, will be explain a bit more? > for y[k] = k^2, slope is 2k and is increasing, while for y[k] = - k^2, > slope -2k is decreasing. How does it affect the result? > > Did you give some thought to the index thing? Less or more accurate is > another issue, result of BDA applies to the time at which calculation is > being done. It can be proved very easily: > f(x0-h) = f(x0) - h f'(x0) + O(h^2) > f'(x0) = (f(x0)-f(x0-h))/h + O(h) > Look at the index x0 on both sides of the equation. > > > Ishtiaq.
Ishtiaq, What am I to do with y[k] = k^2? I think you mean x[k] = k^2; y[k] (the derivative) = x[k] - x[k-1] = k^2 - (k-1)^2 = 2k-1. The true derivative at k is 2k. The computed derivative, 2k-1, applies to some time between k and k-1; i.e., some time in the past. The computed derivative is the slope of a line passing through x[k-1], y[k-1] and x[k], y[k]. a secant to the curve beginning in the past and ending at the present. To a first approximation, the secant is parallel to a tangent of the curve half way between the times k-1 and k. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
This is a multi-part message in MIME format.

------=_NextPart_000_01FE_01C3F14C.71B17690
Content-Type: text/plain;
	charset="iso-2022-jp"
Content-Transfer-Encoding: quoted-printable


"I. R. Khan" <ir_khan@hotmail.com> wrote in message =
news:c0emii$15qt20$1@ID-198607.news.uni-berlin.de...
> Hi all, >=20 > I shall try to make the things clear with an example: >=20 > Suppose we are having a nice digital thermometer in an office, which > measures temperature with an interval of one hour and stores three =
readings
> at a time. Now at 6 pm every one is asked to calculate the rate at =
which
> temperature is changing at 6 pm. >=20 > One guy uses t'[6]=3D(3t[6]-4t[5]+t[4])/2, and gets the result =
immediately.
> i.e., without any delay. > Another guy complains that the data is insufficient for his formula =
and
> waits till 7 pm and gets the result as t'[6]=3D(t[7]+0t[6]-t[5])/2. =
i.e. at 7
> pm he got the rate at which temperature was changing at 6 pm. i.e., =
with a
> delay of one hour, i.e., one sample delay. > Third fellow has his own formula and waits till 8 pm to calculate > t'[6]=3D(-3t[8]+4t[7]-t[6])/2. So he result comes with delay of two =
hours,
> i.e., 2 samples delay.
Ishtiaq, Perhaps to help .... we often get hung up on time base things like this. = =20 The electrical engineers amongst us (if I may be so bold) tend to think = of things in real time. Other analysts tend to think of operations on stored arrays of numbers. The former don't admit non-causal systems as "real". The latter talk about non-causal filters such as those that use data in = the "future". The critical difference between the two time base perspectives is this: The "engineering" viewpoint focuses on time=3Dnow The analysts viewpoint focuses on time=3D{pretty much anything they = decide for the applcation??} For example, let's take a real, even interpolating filter of length N = (an odd integer) with coefficients=20 [1/2 1 1/2]: The "engineering" viewpoint would say that the interpolator's output is = delayed by 1 sample (or 1/2 sample) because it makes use of one sample = that comes after the point in time at which the interpolation output is = aligned. An "analysts" viewpoint might say that the interpolator is non-causal = and has zero delay. But the latter begs the question about "what is your time reference" = which you have to supply (as you have done with t'[6] ). The former is always consistent. I also note that adding zero coefficients at the leading edge of a = filter to introduce artificial delay isn't useful in most analytical = discussions. So, I believe it's confusing to use the notation t'[6] when common = notation would be: y[6]=3D3t[6]-4t[5]+t[4])/2 y[7]=3D(t[7]+0t[6]-t[5])/2 y[8]=3D(-3t[8]+4t[7]-t[6])/2 These are written in the context of a time base we can all understand. = Note that no output "y" can precede any input "x" - that would be = impossible in this notation / an error. Now, if you want to label: y[k]=3Dt'[k] or y[k]=3Dt'[k-1] or y[k]=3Dt'[k-2] that's up to you. =20 But these labels are application dependent in the sense that you chose = the algorithm. Only you can know (without further analysis by the = reader - perhaps minor analysis) that y[k] represents a derivative or = some other thing and at which time it might best estimate the same. So, both methods are in common use but should not be confused. It = appears to me that the engineering approach is less likely to generate = confusion and requires less qualification. If I tell you a filter is = going to be applied with coefficients [1/2 1 1/2] then a delay is = implied for sure. Since it's symmetric, we apply a little analysis and = decide that the delay is flat and equal to one sample. Otherwise, we = don't know what the delay is without even more analysis. So, to repeat, = the delay is not the same as the "label" that the algorithm designer = intends to use. Fred ------=_NextPart_000_01FE_01C3F14C.71B17690 Content-Type: text/html; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-2022-jp"> <META content=3D"MSHTML 6.00.2737.800" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff background=3D""><FONT face=3D"Courier New"=20 size=3D2></FONT><BR><FONT face=3D"Courier New" size=3D2>"I. R. Khan"=20 &lt;ir_khan@hotmail.com&gt; wrote in message=20 news:c0emii$15qt20$1@ID-198607.news.uni-berlin.de...<BR>&gt; Hi = all,<BR>&gt;=20 <BR>&gt; I shall try to make the things clear with an example:<BR>&gt; = <BR>&gt;=20 Suppose we are having a nice digital thermometer in an office, = which<BR>&gt;=20 measures temperature with an interval of one hour and stores three=20 readings<BR>&gt; at a time. Now at 6 pm every one is asked to calculate = the rate=20 at which<BR>&gt; temperature is changing at 6 pm.<BR>&gt; <BR>&gt; One = guy uses=20 t'[6]=3D(3t[6]-4t[5]+t[4])/2, and gets the result immediately.<BR>&gt; = i.e.,=20 without any delay.<BR>&gt; Another guy complains that the data is = insufficient=20 for his formula and<BR>&gt; waits till 7 pm and gets the result as=20 t'[6]=3D(t[7]+0t[6]-t[5])/2. i.e. at 7<BR>&gt; pm he got the rate at = which=20 temperature was changing at 6 pm. i.e., with a<BR>&gt; delay of one = hour, i.e.,=20 one sample delay.<BR>&gt; Third fellow has his own formula and waits = till 8 pm=20 to calculate<BR>&gt; t'[6]=3D(-3t[8]+4t[7]-t[6])/2. So he result comes = with delay=20 of two hours,<BR>&gt; i.e., 2 samples = delay.<BR><BR>Ishtiaq,<BR><BR>Perhaps to=20 help .... we often get hung up on time base things like this.&nbsp; = <BR>The=20 electrical engineers amongst us (if I may be so bold) tend to think of = things in=20 real time.<BR>Other analysts tend to think of operations on stored = arrays of=20 numbers.<BR>The former don't admit non-causal systems as "real".<BR>The = latter=20 talk about non-causal filters such as those that use data in the=20 "future".<BR><BR>The critical difference between the two time base = perspectives=20 is this:<BR>The "engineering" viewpoint focuses on time=3Dnow<BR>The = analysts=20 viewpoint focuses on time=3D{pretty much anything they decide for the=20 applcation??}<BR>For example, let's take a real, even interpolating = filter of=20 length N (an odd integer) with coefficients <BR>[1/2&nbsp; 1&nbsp; = 1/2]:<BR>The=20 "engineering" viewpoint would say that the interpolator's output is = delayed by 1=20 sample (or 1/2 sample) because it makes use of one sample that comes = after the=20 point in time at which the interpolation output is aligned.<BR>An = "analysts"=20 viewpoint might say that the interpolator is non-causal and has zero=20 delay.<BR>But the latter begs the question about "what is your time = reference"=20 which you have to supply (as you have done with t'[6] ).<BR>The former = is always=20 consistent.<BR><BR>I also note that adding zero coefficients at the = leading edge=20 of a filter to introduce artificial delay isn't useful in most = analytical=20 discussions.<BR><BR>So, I believe it's confusing to use the notation = t'[6] when=20 common notation would=20 be:<BR>y[6]=3D3t[6]-4t[5]+t[4])/2<BR>y[7]=3D(t[7]+0t[6]-t[5])/2<BR>y[8]=3D= (-3t[8]+4t[7]-t[6])/2<BR>These=20 are written in the context of a time base we can all understand.&nbsp; = Note that=20 no output "y" can precede any input "x" - that would be impossible in = this=20 notation / an error.<BR><BR>Now, if you want to label:<BR>y[k]=3Dt'[k]=20 or<BR>y[k]=3Dt'[k-1] or<BR>y[k]=3Dt'[k-2]<BR>that's up to you.&nbsp; = <BR>But these=20 labels are application dependent in the sense that you chose the=20 algorithm.&nbsp; Only you can know (without further analysis by the = reader -=20 perhaps minor analysis) that y[k] represents a derivative or some other = thing=20 and at which time it might best estimate the same.<BR><BR>So, both = methods are=20 in common use but should not be confused.&nbsp; It appears to me that = the=20 engineering approach is less likely to generate confusion and requires = less=20 qualification.&nbsp; If I tell you a filter is going to be applied with=20 coefficients [1/2&nbsp; 1&nbsp; 1/2] then a delay is implied for = sure.&nbsp;=20 Since it's symmetric, we apply a little analysis and decide that the = delay is=20 flat and equal to one sample.&nbsp; Otherwise, we don't know what the = delay is=20 without even more analysis.&nbsp; So, to repeat,&nbsp;the delay is not = the same=20 as the "label" that the algorithm designer intends to=20 use.<BR><BR>Fred</FONT></BODY></HTML> ------=_NextPart_000_01FE_01C3F14C.71B17690--
> What am I to do with y[k] = k^2? I think you mean x[k] = k^2; y[k] (the > derivative) = x[k] - x[k-1] = k^2 - (k-1)^2 = 2k-1. The true derivative > at k is 2k. The computed derivative, 2k-1, applies to some time between > k and k-1; i.e., some time in the past. The computed derivative is the > slope of a line passing through x[k-1], y[k-1] and x[k], y[k]. a secant > to the curve beginning in the past and ending at the present. To a first > approximation, the secant is parallel to a tangent of the curve half way > between the times k-1 and k. > > Jerry
>What am I to do with y[k] = k^2? I think you mean x[k] = k^2; y[k]
(the
>derivative) = x[k] - x[k-1] = k^2 - (k-1)^2 = 2k-1. The true
derivative
>at k is 2k. The computed derivative, 2k-1, applies to some time
between
>k and k-1; i.e., some time in the past. The computed derivative is
the
>slope of a line passing through x[k-1], y[k-1] and x[k], y[k]. a
secant
>to the curve beginning in the past and ending at the present. To a
first
>approximation, the secant is parallel to a tangent of the curve half
way
>between the times k-1 and k. > >Jerry
Ok jerry that was nice, but let's go beyond first order, because x[k]-x[k-1] belongs to both BDA and even-length CDA families and causing confusions. Please comment on the following: The following filter y[k] = (3x[k]-4x[k-1]+x[k-2])/2 calculates derivative of all polynomils of order less than 3 with zero delay. Do you agree with this?
Thanks Fred, for your nice explaination and it really helped.

The discussion started when Rick said that FIR filter cannot be
designed with zero delay and I noted that BDAs have no delay. I mean
the delay as the difference between calculation time and the time at
which result was most accurate. Perhaps this is what all electrical
engineers mean.

Let's take x[k] = k^2, then
y[k] = (3x[k]-4x[k-1]+x[k-2])/2 = (3k^2-4(k-1)^2+(k-2)^2)/2=2k,

which is the true derivative of x at k not at some k-alpha. Does it
not mean that there is no delay in this case?

You can argue, that a BDA are not accurate at even moderately high
frequencies, but still it is an FIR filter. I can call it "zero delay
FIR polynomial differentiator", with zero error as far as polynomial
order is below the order of BDA. In fact you can define the order of
polynomial and I can give you zero-delay zero-error BDA differentiator
for it. We can in fact call BDAs as non-symmetric (hence non-linear
phase) maximally linear differentiators.

Regards,
Ishtiaq.

> Ishtiaq, > > Perhaps to help .... we often get hung up on time base things like this. > > The electrical engineers amongst us (if I may be so bold) tend to think > of things in real time. > Other analysts tend to think of operations on stored arrays of numbers. > The former don't admit non-causal systems as "real". > The latter talk about non-causal filters such as those that use data in > the "future". > > The critical difference between the two time base perspectives is this: > The "engineering" viewpoint focuses on time=now > The analysts viewpoint focuses on time={pretty much anything they > decide for the applcation??} > For example, let's take a real, even interpolating filter of length N > (an odd integer) with coefficients > [1/2 1 1/2]: > The "engineering" viewpoint would say that the interpolator's output is > delayed by 1 sample (or 1/2 sample) because it makes use of one sample > that comes after the point in time at which the interpolation output is > aligned. > An "analysts" viewpoint might say that the interpolator is non-causal > and has zero delay. > But the latter begs the question about "what is your time reference" > which you have to supply (as you have done with t'[6] ). > The former is always consistent. > > I also note that adding zero coefficients at the leading edge of a > filter to introduce artificial delay isn't useful in most analytical > discussions. > > So, I believe it's confusing to use the notation t'[6] when common > notation would be: > y[6]=3t[6]-4t[5]+t[4])/2 > y[7]=(t[7]+0t[6]-t[5])/2 > y[8]=(-3t[8]+4t[7]-t[6])/2 > These are written in the context of a time base we can all understand. > Note that no output "y" can precede any input "x" - that would be > impossible in this notation / an error. > > Now, if you want to label: > y[k]=t'[k] or > y[k]=t'[k-1] or > y[k]=t'[k-2] > that's up to you. > But these labels are application dependent in the sense that you chose > the algorithm. Only you can know (without further analysis by the > reader - perhaps minor analysis) that y[k] represents a derivative or > some other thing and at which time it might best estimate the same. > > So, both methods are in common use but should not be confused. It > appears to me that the engineering approach is less likely to generate > confusion and requires less qualification. If I tell you a filter is > going to be applied with coefficients [1/2 1 1/2] then a delay is > implied for sure. Since it's symmetric, we apply a little analysis and > decide that the delay is flat and equal to one sample. Otherwise, we > don't know what the delay is without even more analysis. So, to repeat, > the delay is not the same as the "label" that the algorithm designer > intends to use. > > Fred > > --
"IR Khan" <ir_khan@hotmail.com> wrote in message
news:30d14f77.0402121855.2bb5a359@posting.google.com...
> Thanks Fred, for your nice explaination and it really helped. > > The discussion started when Rick said that FIR filter cannot be > designed with zero delay and I noted that BDAs have no delay. I mean > the delay as the difference between calculation time and the time at > which result was most accurate. Perhaps this is what all electrical > engineers mean.
Ishtiaq, Definitely not. The only meaning that I believe is in consistent engineering use is this: y[k]=a*x[k]+b*x[k-1]+c*x[k-2]+.....z*x[k-large number] there are no terms here where the index on x is larger than k - aka: causality Also, it makes no real sense for a to be zero or thence b to be zero or thence c to be zero..... "a" has to be nonzero. Thus, I believe this is what Rick must have been referring to - and I did not find his post you refer to..... The point at which a calculation "is most accurate" is an anlytical definition. We are simply counting and indexing sample times according to a very simple rule. That was the entire point of my last post. So, I will say it so as not to echo Rick's post that I can't find: A FIR filter cannot be designed with zero delay if one uses the engineering sort of definition which includes causality as a requirement for a realizable physical system. This is a very useful convention and the literature and analysis is loaded with it. A FIR filter *can* be designed with zero delay if one uses an "analysts definition" which allows non-causal time alignment. One must note that such a filter cannot compute an output until all of the inputs have occurred. If time of the output is aligned with when the inputs occur, then one is forced back to the engineering definition of time base. Accuracy has nothing to do with any of this. But, it may be useful if you present a very specific context. For example:
> > Let's take x[k] = k^2, then > y[k] = (3x[k]-4x[k-1]+x[k-2])/2 = (3k^2-4(k-1)^2+(k-2)^2)/2=2k, > > which is the true derivative of x at k not at some k-alpha. Does it > not mean that there is no delay in this case? >
No, it does not mean that there is no delay in this case. y[k] = (3/2)*x[k] - 2*x[k-1] + x/2[k-2] What happens if the input is [long ago ..... 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 ...... ad infinitum] and we define time=0 where the first "1" occurs? The output is: 0.5 -1.5 0 0 0 0 0 0 0....... You have the choice of 0.5, -1.5 or zero as a singular output. There is a transient response time of 2 samples, so it can't be 0.5 or -1.5, so it must be zero. The zero doesn't occur until the third sample. That's a type of measure of delay. We can also measure the phase slope around zero frequency to get the delay - even though the phase is zero at zero frequency, the phase slope or delay are not. The other problem with your example is that you assumed an input. That doesn't work. Any input must be allowed. So, what you *can* say is more something like this: Here is a filter which will output y[k]=x'[k] if and only if x[k]=k^2. With this distinction, delay becomes immaterial. And, you could just have easilty created an algorithm where y[k+1]=a*x[k]+b*x[k-1]+c*x[k-2]+.....z*x[k-large number] even though this isn't a form that I like because there's a zero coefficient on x{k+1] and you cannot say: y[k-1]=a*x[k]+b*x[k-1]+c*x[k-2]+.....z*x[k-large number] because you're using an as-yet undefined data sample x[k]. We could also find any number of filters I'm sure that have a similar or even more general property such as: "Here's a filter that predicts the future" y[k+12]=a*x[k] + b*x[k-1] ......etc. However, note that the labeling of y[k+12] isn't justified because we would have to write: y[k+12]=0*x[k+12] + 0*x[k+11] ..... 0*x[k+1) + a*x[k] + b*x[k-1] ...... so what we really should have written was: y[k]=a*x[k] + b*x[k-1] ......etc. and then NOTE that y[k] is a prediction of y[k+12] The two are not the same thing at all!! it's not y[k+12] but y[k] > an estimate of y[k+12] y[k+12] is clearly defined as y[k+12] = a*x[k+12] + b*x[k+11] + c*x[k+11] .... The index on y is not what you "feel" it should be. It's the index that belongs to the filter and to the input. Thus our ability to clearly define delay without ambiguity. There is an example that I believe makes really good sense for the analytical definition for a filter: Imagine an odd-order symmetrical FIR filter being used for interpolation - one which does not change the original sample values - such as a half-band filter. Align the filter with the center coefficient at zero time. The outputs of the filter will not be delayed by definition because the filter isn't causal. However, the time alignment of the input samples will be exactly the same as the time alignment of the input samples. Accordingly you very readily know which samples at the output are the originals and which are the interpolated values. I find this very handy but it doesn't change the definitions above and all of the data has to be available before the filter can be applied (thus a real world delay). Fred