Rune wrote:> On 2 Apr, 03:20, info2...@parse.com (Robert Krten) wrote: > > > Rune Allnor <all...@tele.ntnu.no> wrote: > > > On 1 Apr, 04:33, info2...@parse.com (Robert Krten) wrote: > > > > The problem I'm running into is that the output of the filter follows the > > > > input shape (the low frequency component). > > > Stock data and FIR filters? Of course. Stock data are > > > non-starionary. FIR filters compute the weighted avreage > > > of a finite number of data points. If there is a trend in > > > the data which is far longer than the FIR filter -- and > > > such a trend exists in stock data -- this is exactly > > > what one would expect to see. > > > That would apply to the very long sequences, i.e., the "years" samples, > > given insufficent length. But when I have 2 years worth of samples, > > and I'm filtering for an 8-day trend, I would expect it to work... > > You don't get my point: The stock market data don't comply with > the assumtions about data the FIR filter techniques is based on.Rune, what the heck are you talking about??> > The types of signals which are analyzed in the realms of DSP > are assumed to be of type "finite energy" or "finite power". > Such signals are a bit restricted with respect to arbitrary > data sequences in that they have a finite mean value.What does the mean of a sequence of numbers have to do with FIR filtering (or, in fact, anything)? Anycase, every (finite) sequence of numbers has a finite mean. I really don't get your point.> This > mean value is often - but not always - zero. > > Stock market data do not exhibit this limitation.It's no limitation. Are you saying that only zero-mean data can be filtered? Obviously you are not, but I haven't the slightest clue what your objection is to filtering (or DFT) analysis of stock market data as compared to, say, seismic, radar or audio data.> While only > finite amounts of such data have been obsreved, the general > trend is that such data grow with time. So if you want to > analyze these sorts of data, you need to look elsewhere than > DSP for analysis techniques.A filter is a filter. You can apply it with equal justification to any type of sequence of numbers for the usual effects (namely, to attenuate or accentuate certain frequency bands). Polynomial trends can be equally well filtered using the same techniques (being, as they are, special cases of sinusoids).> > Since the FIR filter is a numerical routine, it will produce a > numerical result, and in that sense, it might be said to "work". > However, _a_ numerical result does not mean a _useful_ or > _relevant_ numerical result.That I agree, even if it is completely beside the point. Regards, Andor
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →
FIR Bandpass filtering (C code)
Started by ●March 31, 2007
Reply by ●April 2, 20072007-04-02
Reply by ●April 2, 20072007-04-02
Rune wrote:> On 2 Apr, 03:20, info2...@parse.com (Robert Krten) wrote: > > > Rune Allnor <all...@tele.ntnu.no> wrote: > > > On 1 Apr, 04:33, info2...@parse.com (Robert Krten) wrote: > > > > The problem I'm running into is that the output of the filter follows the > > > > input shape (the low frequency component). > > > Stock data and FIR filters? Of course. Stock data are > > > non-starionary. FIR filters compute the weighted avreage > > > of a finite number of data points. If there is a trend in > > > the data which is far longer than the FIR filter -- and > > > such a trend exists in stock data -- this is exactly > > > what one would expect to see. > > > That would apply to the very long sequences, i.e., the "years" samples, > > given insufficent length. But when I have 2 years worth of samples, > > and I'm filtering for an 8-day trend, I would expect it to work... > > You don't get my point: The stock market data don't comply with > the assumtions about data the FIR filter techniques is based on.Rune, what the heck are you talking about??> > The types of signals which are analyzed in the realms of DSP > are assumed to be of type "finite energy" or "finite power". > Such signals are a bit restricted with respect to arbitrary > data sequences in that they have a finite mean value.What does the mean of a sequence of numbers have to do with FIR filtering (or, in fact, anything)? Anycase, every (finite) sequence of numbers has a finite mean. I really don't get your point.> This > mean value is often - but not always - zero. > > Stock market data do not exhibit this limitation.It's no limitation. Are you saying that only zero-mean data can be filtered? Obviously you are not, but I haven't the slightest clue what your objection is to filtering (or DFT) analysis of stock market data as compared to, say, seismic, radar or audio data.> While only > finite amounts of such data have been obsreved, the general > trend is that such data grow with time. So if you want to > analyze these sorts of data, you need to look elsewhere than > DSP for analysis techniques.A filter is a filter. You can apply it with equal justification to any type of sequence of numbers for the usual effects (namely, to attenuate or accentuate certain frequency bands). Polynomial trends can be equally well filtered using the same techniques (being, as they are, special cases of sinusoids).> > Since the FIR filter is a numerical routine, it will produce a > numerical result, and in that sense, it might be said to "work". > However, _a_ numerical result does not mean a _useful_ or > _relevant_ numerical result.That I agree, even if it is completely beside the point. Regards, Andor
Reply by ●April 2, 20072007-04-02
On 2 Apr, 21:09, "Andor" <andor.bari...@gmail.com> wrote:> Rune wrote: > > On 2 Apr, 03:20, info2...@parse.com (Robert Krten) wrote: > > > > Rune Allnor <all...@tele.ntnu.no> wrote: > > > > On 1 Apr, 04:33, info2...@parse.com (Robert Krten) wrote: > > > > > The problem I'm running into is that the output of the filter follows the > > > > > input shape (the low frequency component). > > > > Stock data and FIR filters? Of course. Stock data are > > > > non-starionary. FIR filters compute the weighted avreage > > > > of a finite number of data points. If there is a trend in > > > > the data which is far longer than the FIR filter -- and > > > > such a trend exists in stock data -- this is exactly > > > > what one would expect to see. > > > > That would apply to the very long sequences, i.e., the "years" samples, > > > given insufficent length. But when I have 2 years worth of samples, > > > and I'm filtering for an 8-day trend, I would expect it to work... > > > You don't get my point: The stock market data don't comply with > > the assumtions about data the FIR filter techniques is based on. > > Rune, what the heck are you talking about??The basis for DSP. I am sure you know aout energy signals and power signals?> > The types of signals which are analyzed in the realms of DSP > > are assumed to be of type "finite energy" or "finite power". > > Such signals are a bit restricted with respect to arbitrary > > data sequences in that they have a finite mean value. > > What does the mean of a sequence of numbers have to do with FIR > filtering (or, in fact, anything)? Anycase, every (finite) sequence of > numbers has a finite mean. I really don't get your point.If you analyze the nature of a stock market time series, you will find that it has certain properties which are very different from thoe properties of the data encountered in DSP. If you extrapolate a stock market data sequence into the future, it will rise without bound. Well, according to ecomoy theory. Whether that will happen in practice is anybody's guess, but there is nothing in the tehory to suggest and upper limmit exists to the stock market index. So the mean of the stock market index does not exist, in the sense that no theoretical limit can be found on the form M = lim_{N -> infinite} sum_{n=0}^N x_n/N < infinite where x_n is the n'th sample in a stock market data sequence.> > This > > mean value is often - but not always - zero. > > > Stock market data do not exhibit this limitation. > > It's no limitation. Are you saying that only zero-mean data can be > filtered?No. I'm saying that FIR and IIR filters only make sense for energy signals and power signals. These filters are studied in terms of the Fourier tranform, which requires the signals to me integrable(?). The stock market data are not integrable in the sense required by the FT, and hence FIR and IIR filters don't make sense with those sorts of data.> Obviously you are not, but I haven't the slightest clue what > your objection is to filtering (or DFT) analysis of stock market data > as compared to, say, seismic, radar or audio data.Those types of data comply with the requirements of the FT. A tiny detail, but it makes all the difference. Rune
Reply by ●April 2, 20072007-04-02
On 2 Apr., 21:43, "Rune Allnor" <all...@tele.ntnu.no> wrote:> On 2 Apr, 21:09, "Andor" <andor.bari...@gmail.com> wrote: > > > > > > > Rune wrote: > > > On 2 Apr, 03:20, info2...@parse.com (Robert Krten) wrote: > > > > > Rune Allnor <all...@tele.ntnu.no> wrote: > > > > > On 1 Apr, 04:33, info2...@parse.com (Robert Krten) wrote: > > > > > > The problem I'm running into is that the output of the filter follows the > > > > > > input shape (the low frequency component). > > > > > Stock data and FIR filters? Of course. Stock data are > > > > > non-starionary. FIR filters compute the weighted avreage > > > > > of a finite number of data points. If there is a trend in > > > > > the data which is far longer than the FIR filter -- and > > > > > such a trend exists in stock data -- this is exactly > > > > > what one would expect to see. > > > > > That would apply to the very long sequences, i.e., the "years" samples, > > > > given insufficent length. But when I have 2 years worth of samples, > > > > and I'm filtering for an 8-day trend, I would expect it to work... > > > > You don't get my point: The stock market data don't comply with > > > the assumtions about data the FIR filter techniques is based on. > > > Rune, what the heck are you talking about?? > > The basis for DSP. I am sure you know aout energy signals and > power signals? > > > > The types of signals which are analyzed in the realms of DSP > > > are assumed to be of type "finite energy" or "finite power". > > > Such signals are a bit restricted with respect to arbitrary > > > data sequences in that they have a finite mean value. > > > What does the mean of a sequence of numbers have to do with FIR > > filtering (or, in fact, anything)? Anycase, every (finite) sequence of > > numbers has a finite mean. I really don't get your point. > > If you analyze the nature of a stock market time series, > you will find that it has certain properties which are > very different from thoe properties of the data encountered > in DSP.No. It's just another sequence of numbers.> If you extrapolate a stock market data sequence > into the future, it will rise without bound.That depends on how you care to extrapolate the data. Even if the extrapolation explodes, it still doesn't matter.> Well, according > to ecomoy theory. Whether that will happen in practice is > anybody's guess, but there is nothing in the tehory to > suggest and upper limmit exists to the stock market index. > > So the mean of the stock market index does not exist, in > the sense that no theoretical limit can be found on the > form > > M = lim_{N -> infinite} sum_{n=0}^N x_n/N < infinite > > where x_n is the n'th sample in a stock market data sequence. > > > > This > > > mean value is often - but not always - zero. > > > > Stock market data do not exhibit this limitation. > > > It's no limitation. Are you saying that only zero-mean data can be > > filtered? > > No. I'm saying that FIR and IIR filters only make sense for > energy signals and power signals. These filters are studied > in terms of the Fourier tranform, which requires the signals > to me integrable(?). The stock market data are not integrable > in the sense required by the FT, and hence FIR and IIR filters > don't make sense with those sorts of data.So, consider this sequence x_n given by x_n = alpha n + beta cos(w_0 n) + e_n, where 0 < w_0 < pi is known and e_n is some noise. Are you saying I can't use an FIR to filter out the periodic componenent? Or yet another FIR to filter out the polynomial component? Or combine the two to filter out both components to find the residual e_n?> > > Obviously you are not, but I haven't the slightest clue what > > your objection is to filtering (or DFT) analysis of stock market data > > as compared to, say, seismic, radar or audio data. > > Those types of data comply with the requirements of the FT. > A tiny detail, but it makes all the difference.When did you last try to compute the Fourier transform of a sinusoid? Using the same mathematical trick, you can compute the FT of a polynomial (which is, as I said, just a special case of a sinusoid). Regards, Andor
Reply by ●April 2, 20072007-04-02
On 2 Apr., 21:43, "Rune Allnor" <all...@tele.ntnu.no> wrote:> On 2 Apr, 21:09, "Andor" <andor.bari...@gmail.com> wrote: > > > > > > > Rune wrote: > > > On 2 Apr, 03:20, info2...@parse.com (Robert Krten) wrote: > > > > > Rune Allnor <all...@tele.ntnu.no> wrote: > > > > > On 1 Apr, 04:33, info2...@parse.com (Robert Krten) wrote: > > > > > > The problem I'm running into is that the output of the filter follows the > > > > > > input shape (the low frequency component). > > > > > Stock data and FIR filters? Of course. Stock data are > > > > > non-starionary. FIR filters compute the weighted avreage > > > > > of a finite number of data points. If there is a trend in > > > > > the data which is far longer than the FIR filter -- and > > > > > such a trend exists in stock data -- this is exactly > > > > > what one would expect to see. > > > > > That would apply to the very long sequences, i.e., the "years" samples, > > > > given insufficent length. But when I have 2 years worth of samples, > > > > and I'm filtering for an 8-day trend, I would expect it to work... > > > > You don't get my point: The stock market data don't comply with > > > the assumtions about data the FIR filter techniques is based on. > > > Rune, what the heck are you talking about?? > > The basis for DSP. I am sure you know aout energy signals and > power signals? > > > > The types of signals which are analyzed in the realms of DSP > > > are assumed to be of type "finite energy" or "finite power". > > > Such signals are a bit restricted with respect to arbitrary > > > data sequences in that they have a finite mean value. > > > What does the mean of a sequence of numbers have to do with FIR > > filtering (or, in fact, anything)? Anycase, every (finite) sequence of > > numbers has a finite mean. I really don't get your point. > > If you analyze the nature of a stock market time series, > you will find that it has certain properties which are > very different from thoe properties of the data encountered > in DSP.No. It's just another sequence of numbers.> If you extrapolate a stock market data sequence > into the future, it will rise without bound.That depends on how you care to extrapolate the data. Even if the extrapolation explodes, it still doesn't matter.> Well, according > to ecomoy theory. Whether that will happen in practice is > anybody's guess, but there is nothing in the tehory to > suggest and upper limmit exists to the stock market index. > > So the mean of the stock market index does not exist, in > the sense that no theoretical limit can be found on the > form > > M = lim_{N -> infinite} sum_{n=0}^N x_n/N < infinite > > where x_n is the n'th sample in a stock market data sequence. > > > > This > > > mean value is often - but not always - zero. > > > > Stock market data do not exhibit this limitation. > > > It's no limitation. Are you saying that only zero-mean data can be > > filtered? > > No. I'm saying that FIR and IIR filters only make sense for > energy signals and power signals. These filters are studied > in terms of the Fourier tranform, which requires the signals > to me integrable(?). The stock market data are not integrable > in the sense required by the FT, and hence FIR and IIR filters > don't make sense with those sorts of data.So, consider this sequence x_n given by x_n = alpha n + beta cos(w_0 n) + e_n, where 0 < w_0 < pi is known and e_n is some noise. Are you saying I can't use an FIR to filter out the periodic componenent? Or yet another FIR to filter out the polynomial component? Or combine the two to filter out both components to find the residual e_n?> > > Obviously you are not, but I haven't the slightest clue what > > your objection is to filtering (or DFT) analysis of stock market data > > as compared to, say, seismic, radar or audio data. > > Those types of data comply with the requirements of the FT. > A tiny detail, but it makes all the difference.When did you last try to compute the Fourier transform of a sinusoid? Using the same mathematical trick, you can compute the FT of a polynomial (which is, as I said, just a special case of a sinusoid). Regards, Andor
Reply by ●April 2, 20072007-04-02
On 2 Apr., 21:43, "Rune Allnor" <all...@tele.ntnu.no> wrote:> On 2 Apr, 21:09, "Andor" <andor.bari...@gmail.com> wrote: > > > > > > > Rune wrote: > > > On 2 Apr, 03:20, info2...@parse.com (Robert Krten) wrote: > > > > > Rune Allnor <all...@tele.ntnu.no> wrote: > > > > > On 1 Apr, 04:33, info2...@parse.com (Robert Krten) wrote: > > > > > > The problem I'm running into is that the output of the filter follows the > > > > > > input shape (the low frequency component). > > > > > Stock data and FIR filters? Of course. Stock data are > > > > > non-starionary. FIR filters compute the weighted avreage > > > > > of a finite number of data points. If there is a trend in > > > > > the data which is far longer than the FIR filter -- and > > > > > such a trend exists in stock data -- this is exactly > > > > > what one would expect to see. > > > > > That would apply to the very long sequences, i.e., the "years" samples, > > > > given insufficent length. But when I have 2 years worth of samples, > > > > and I'm filtering for an 8-day trend, I would expect it to work... > > > > You don't get my point: The stock market data don't comply with > > > the assumtions about data the FIR filter techniques is based on. > > > Rune, what the heck are you talking about?? > > The basis for DSP. I am sure you know aout energy signals and > power signals? > > > > The types of signals which are analyzed in the realms of DSP > > > are assumed to be of type "finite energy" or "finite power". > > > Such signals are a bit restricted with respect to arbitrary > > > data sequences in that they have a finite mean value. > > > What does the mean of a sequence of numbers have to do with FIR > > filtering (or, in fact, anything)? Anycase, every (finite) sequence of > > numbers has a finite mean. I really don't get your point. > > If you analyze the nature of a stock market time series, > you will find that it has certain properties which are > very different from thoe properties of the data encountered > in DSP.No. It's just another sequence of numbers.> If you extrapolate a stock market data sequence > into the future, it will rise without bound.That depends on how you care to extrapolate the data. Even if the extrapolation explodes, it still doesn't matter.> Well, according > to ecomoy theory. Whether that will happen in practice is > anybody's guess, but there is nothing in the tehory to > suggest and upper limmit exists to the stock market index. > > So the mean of the stock market index does not exist, in > the sense that no theoretical limit can be found on the > form > > M = lim_{N -> infinite} sum_{n=0}^N x_n/N < infinite > > where x_n is the n'th sample in a stock market data sequence. > > > > This > > > mean value is often - but not always - zero. > > > > Stock market data do not exhibit this limitation. > > > It's no limitation. Are you saying that only zero-mean data can be > > filtered? > > No. I'm saying that FIR and IIR filters only make sense for > energy signals and power signals. These filters are studied > in terms of the Fourier tranform, which requires the signals > to me integrable(?). The stock market data are not integrable > in the sense required by the FT, and hence FIR and IIR filters > don't make sense with those sorts of data.So, consider this sequence x_n given by x_n = alpha n + beta cos(w_0 n) + e_n, where 0 < w_0 < pi is known and e_n is some noise. Are you saying I can't use an FIR to filter out the periodic componenent? Or yet another FIR to filter out the polynomial component? Or combine the two to filter out both components to find the residual e_n?> > > Obviously you are not, but I haven't the slightest clue what > > your objection is to filtering (or DFT) analysis of stock market data > > as compared to, say, seismic, radar or audio data. > > Those types of data comply with the requirements of the FT. > A tiny detail, but it makes all the difference.When did you last try to compute the Fourier transform of a sinusoid? Using the same mathematical trick, you can compute the FT of a polynomial (which is, as I said, just a special case of a sinusoid). Regards, Andor
Reply by ●April 2, 20072007-04-02
On 2 Apr, 22:10, "Andor" <andor.bari...@gmail.com> wrote:> On 2 Apr., 21:43, "Rune Allnor" <all...@tele.ntnu.no> wrote:> > > It's no limitation. Are you saying that only zero-mean data can be > > > filtered? > > > No. I'm saying that FIR and IIR filters only make sense for > > energy signals and power signals. These filters are studied > > in terms of the Fourier tranform, which requires the signals > > to me integrable(?). The stock market data are not integrable > > in the sense required by the FT, and hence FIR and IIR filters > > don't make sense with those sorts of data. > > So, consider this sequence x_n given by > > x_n = alpha n + beta cos(w_0 n) + e_n, > > where 0 < w_0 < pi is known and e_n is some noise. Are you saying I > can't use an FIR to filter out the periodic componenent? Or yet > another FIR to filter out the polynomial component? Or combine the two > to filter out both components to find the residual e_n?Something may have gone missing in your expression above, so I take the liberty to reformulate: x_n = a*n + b*cos(wn) + e_n a,b =/= 0 Assume for simplicity that we have N components and that w = k/N*pi for some integer k. If we agree on this formulation, I put to you the following: 1) The ramp a*n may (or may not) have a non-zero Fourier component at the frequency w. 2) The cosine certainly has a non-zero Fourier component at frequency w. 3) The white noise does probably have a non-zero Fourier component at frequency w. 4) In the event that all three terms contribute with non-zero Fourier components at frequency w, no FIR or IIR filter will be able to separate the contributions from each respective term. Rune
Reply by ●April 2, 20072007-04-02
Rune Allnor wrote:> So the mean of the stock market index does not exist, in > the sense that no theoretical limit can be found on the > form > > M = lim_{N -> infinite} sum_{n=0}^N x_n/N < infiniteIsn't the same true of any audio or seismic data (especially if you extend the sequence back to before the big bang)? I would think the main complaint against filtering daily indices would be that, it's a non-linear system, and that the raw data isn't bandlimited. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
Reply by ●April 3, 20072007-04-03
On 2 Apr., 22:46, "Rune Allnor" <all...@tele.ntnu.no> wrote:> On 2 Apr, 22:10, "Andor" <andor.bari...@gmail.com> wrote: > > > > > > > On 2 Apr., 21:43, "Rune Allnor" <all...@tele.ntnu.no> wrote: > > > > It's no limitation. Are you saying that only zero-mean data can be > > > > filtered? > > > > No. I'm saying that FIR and IIR filters only make sense for > > > energy signals and power signals. These filters are studied > > > in terms of the Fourier tranform, which requires the signals > > > to me integrable(?). The stock market data are not integrable > > > in the sense required by the FT, and hence FIR and IIR filters > > > don't make sense with those sorts of data. > > > So, consider this sequence x_n given by > > > x_n = alpha n + beta cos(w_0 n) + e_n, > > > where 0 < w_0 < pi is known and e_n is some noise. Are you saying I > > can't use an FIR to filter out the periodic componenent? Or yet > > another FIR to filter out the polynomial component? Or combine the two > > to filter out both components to find the residual e_n? > > Something may have gone missing in your expression above, > so I take the liberty to reformulate: > > x_n = a*n + b*cos(wn) + e_n a,b =/= 0 > > Assume for simplicity that we have N components and that > w = k/N*pi for some integer k. > > If we agree on this formulation, I put to you the following: > > 1) The ramp a*n may (or may not) have a non-zero Fourier > component at the frequency w. > 2) The cosine certainly has a non-zero Fourier component > at frequency w. > 3) The white noise does probably have a non-zero Fourier > component at frequency w. > 4) In the event that all three terms contribute with > non-zero Fourier components at frequency w, no FIR or > IIR filter will be able to separate the contributions > from each respective term. > > RuneYou answered four questions that I didn't ask. My question was simple: is it possible to filter out the periodic component in the above (non- stationary) time series with a FIR filter? Regards, Andor
Reply by ●April 3, 20072007-04-03
On 2 Apr., 22:46, "Rune Allnor" <all...@tele.ntnu.no> wrote:> On 2 Apr, 22:10, "Andor" <andor.bari...@gmail.com> wrote: > > > > > > > On 2 Apr., 21:43, "Rune Allnor" <all...@tele.ntnu.no> wrote: > > > > It's no limitation. Are you saying that only zero-mean data can be > > > > filtered? > > > > No. I'm saying that FIR and IIR filters only make sense for > > > energy signals and power signals. These filters are studied > > > in terms of the Fourier tranform, which requires the signals > > > to me integrable(?). The stock market data are not integrable > > > in the sense required by the FT, and hence FIR and IIR filters > > > don't make sense with those sorts of data. > > > So, consider this sequence x_n given by > > > x_n = alpha n + beta cos(w_0 n) + e_n, > > > where 0 < w_0 < pi is known and e_n is some noise. Are you saying I > > can't use an FIR to filter out the periodic componenent? Or yet > > another FIR to filter out the polynomial component? Or combine the two > > to filter out both components to find the residual e_n? > > Something may have gone missing in your expression above, > so I take the liberty to reformulate: > > x_n = a*n + b*cos(wn) + e_n a,b =/= 0 > > Assume for simplicity that we have N components and that > w = k/N*pi for some integer k. > > If we agree on this formulation, I put to you the following: > > 1) The ramp a*n may (or may not) have a non-zero Fourier > component at the frequency w. > 2) The cosine certainly has a non-zero Fourier component > at frequency w. > 3) The white noise does probably have a non-zero Fourier > component at frequency w. > 4) In the event that all three terms contribute with > non-zero Fourier components at frequency w, no FIR or > IIR filter will be able to separate the contributions > from each respective term. > > RuneYou answered four questions that I didn't ask. My question was simple: is it possible to filter out the periodic component in the above (non- stationary) time series with a FIR filter? Regards, Andor







