FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > DSP

DSP comp.dsp newsgroup, mailing list

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-23-2009, 02:23 PM
Alex_001
Guest
 
Posts: n/a
Default integration of a continuous function

Hi,
it's well known that sampling a continuous function according to th
sampling theorem requirements, you get all the information on th
contunuous function just from the samples.
now, if you have to get an accurate estimate of the integral of th
continous function from samples satisfying the sampling theore
requirements, how can you get a good estimate of such an integral?
I noticed that if you use a sampling frequency close to the Nyquist rat
and apply the definition of integration in the time domain ( sum(Xi
delta(x))) the value you get for the integral is totally inaccurate...
I hope the problem is clear...
thanks
Alex



Reply With Quote
  #2 (permalink)  
Old 02-23-2009, 02:46 PM
illywhacker
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On Feb 23, 2:23*pm, "Alex_001" <a.bast...@email.it> wrote:
> Hi,
> it's well known that sampling a continuous function according to the
> sampling theorem requirements, you get all the information on the
> contunuous function just from the samples.
> now, if you have to get an accurate estimate of the integral of the
> continous function from samples satisfying the sampling theorem
> requirements, how can you *get a good estimate of such an integral?
> I noticed that if you use a sampling frequency close to the Nyquist rate
> and apply the definition of integration in the time domain ( sum(Xi*
> delta(x))) the value you get for the integral is totally inaccurate...


You can express the original continuous function as a linear
combination of shifted sinc functions weighted by the sample values.
This is the reconstruction theorem. Any integral of the original
continuous function is therefore a linear combination of integrated
shifted sinc functions weighted by the sample values.

illywhacker;
Reply With Quote
  #3 (permalink)  
Old 02-23-2009, 03:21 PM
Rune Allnor
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On 23 Feb, 14:23, "Alex_001" <a.bast...@email.it> wrote:
> Hi,
> it's well known that sampling a continuous function according to the
> sampling theorem requirements, you get all the information on the
> contunuous function just from the samples.
> now, if you have to get an accurate estimate of the integral of the
> continous function from samples satisfying the sampling theorem
> requirements, how can you *get a good estimate of such an integral?
> I noticed that if you use a sampling frequency close to the Nyquist rate
> and apply the definition of integration in the time domain ( sum(Xi*
> delta(x))) the value you get for the integral is totally inaccurate...


Numerically integrating continuous functions and sampling
are two different cups of tea. If you have an analytical
expression for the function, you can use integration
schemes with different inherent accuracies, as well as
adaptive integration schemes.

Besides, sampling close to the Nyquist limit is a bad idea
anyway; it would do you no favours with integration eiter.

Rune
Reply With Quote
  #4 (permalink)  
Old 02-23-2009, 04:15 PM
Vladimir Vassilevsky
Guest
 
Posts: n/a
Default Re: integration of a continuous function




Alex_001 wrote:
> Hi,
> it's well known that sampling a continuous function according to the
> sampling theorem requirements, you get all the information on the
> contunuous function just from the samples.


Cut the bullshit. What are you really trying to do?

> now, if you have to get an accurate estimate of the integral of the
> continous function from samples satisfying the sampling theorem
> requirements, how can you get a good estimate of such an integral?


Practical advice: represent the function as the polynomial approximation
based on the sampled data. Take the integral from there.

> I noticed that if you use a sampling frequency close to the Nyquist rate
> and apply the definition of integration in the time domain ( sum(Xi*
> delta(x))) the value you get for the integral is totally inaccurate...
> I hope the problem is clear...


Yes, the problem is clear: you are clueles, stupid and lazy.

> thanks
> Alex


Go to hell.

VLV
Reply With Quote
  #5 (permalink)  
Old 02-23-2009, 04:19 PM
John
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On Feb 23, 8:46*am, illywhacker <illywac...@gmail.com> wrote:
> On Feb 23, 2:23*pm, "Alex_001" <a.bast...@email.it> wrote:
>
> > Hi,
> > it's well known that sampling a continuous function according to the
> > sampling theorem requirements, you get all the information on the
> > contunuous function just from the samples.
> > now, if you have to get an accurate estimate of the integral of the
> > continous function from samples satisfying the sampling theorem
> > requirements, how can you *get a good estimate of such an integral?
> > I noticed that if you use a sampling frequency close to the Nyquist rate
> > and apply the definition of integration in the time domain ( sum(Xi*
> > delta(x))) the value you get for the integral is totally inaccurate...

>
> You can express the original continuous function as a linear
> combination of shifted sinc functions weighted by the sample values.
> This is the reconstruction theorem. Any integral of the original
> continuous function is therefore a linear combination of integrated
> shifted sinc functions weighted by the sample values.
>
> illywhacker;


Is this another way of saying interpolate by a large factor using a
sinc filter and then do sum(Xi*deltaX)?

John
Reply With Quote
  #6 (permalink)  
Old 02-23-2009, 04:27 PM
John
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On Feb 23, 10:15*am, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
> Alex_001 wrote:
> > Hi,
> > it's well known that sampling a continuous function according to the
> > sampling theorem requirements, you get all the information on the
> > contunuous function just from the samples.

>
> Cut the bullshit. What are you really trying to do?
>
> > now, if you have to get an accurate estimate of the integral of the
> > continous function from samples satisfying the sampling theorem
> > requirements, how can you *get a good estimate of such an integral?

>
> Practical advice: represent the function as the polynomial approximation
> based on the sampled data. Take the integral from there.
>
> > I noticed that if you use a sampling frequency close to the Nyquist rate
> > and apply the definition of integration in the time domain ( sum(Xi*
> > delta(x))) the value you get for the integral is totally inaccurate...
> > I hope the problem is clear...

>
> Yes, the problem is clear: you are clueles, stupid and lazy.
>
> > thanks
> > Alex

>
> Go to hell.
>
> VLV


Did you sleep well last night?

John
Reply With Quote
  #7 (permalink)  
Old 02-23-2009, 04:36 PM
Alex_001
Guest
 
Posts: n/a
Default Re: integration of a continuous function

>On Feb 23, 10:15=A0am, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
>wrote:
>> Alex_001 wrote:
>> > Hi,
>> > it's well known that sampling a continuous function according to the
>> > sampling theorem requirements, you get all the information on the
>> > contunuous function just from the samples.

>>
>> Cut the bullshit. What are you really trying to do?
>>
>> > now, if you have to get an accurate estimate of the integral of the
>> > continous function from samples satisfying the sampling theorem
>> > requirements, how can you =A0get a good estimate of such a

integral?
>>
>> Practical advice: represent the function as the polynomia

approximation
>> based on the sampled data. Take the integral from there.
>>
>> > I noticed that if you use a sampling frequency close to the Nyquis

rat=
>e
>> > and apply the definition of integration in the time domain ( sum(Xi*
>> > delta(x))) the value you get for the integral is totall

inaccurate...
>> > I hope the problem is clear...

>>
>> Yes, the problem is clear: you are clueles, stupid and lazy.
>>
>> > thanks
>> > Alex

>>
>> Go to hell.
>>
>> VLV

>
>Did you sleep well last night?
>
>John
>



Thank you guys, I appreciate your help.

for VLV: I know the problem could be pretty trivial, but I do not wor
100% of my time on this...and I just wanted to know if there was a esas
solution.
Anyway, nobody forced you to read my thread and reply, did someone?

Alex
Reply With Quote
  #8 (permalink)  
Old 02-23-2009, 06:18 PM
illywhacker
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On Feb 23, 4:19*pm, John <sampson...@gmail.com> wrote:
> On Feb 23, 8:46*am, illywhacker <illywac...@gmail.com> wrote:
>
>
>
> > On Feb 23, 2:23*pm, "Alex_001" <a.bast...@email.it> wrote:

>
> > > Hi,
> > > it's well known that sampling a continuous function according to the
> > > sampling theorem requirements, you get all the information on the
> > > contunuous function just from the samples.
> > > now, if you have to get an accurate estimate of the integral of the
> > > continous function from samples satisfying the sampling theorem
> > > requirements, how can you *get a good estimate of such an integral?
> > > I noticed that if you use a sampling frequency close to the Nyquist rate
> > > and apply the definition of integration in the time domain ( sum(Xi*
> > > delta(x))) the value you get for the integral is totally inaccurate....

>
> > You can express the original continuous function as a linear
> > combination of shifted sinc functions weighted by the sample values.
> > This is the reconstruction theorem. Any integral of the original
> > continuous function is therefore a linear combination of integrated
> > shifted sinc functions weighted by the sample values.

>
> > illywhacker;

>
> Is this another way of saying interpolate by a large factor using a
> sinc filter and then do sum(Xi*deltaX)?


Yes. but the sinc function is determined by the sampling procedure and
the maximum frequency in the original signal, which it is, I think,
necessary to know.

illywhacker;
Reply With Quote
  #9 (permalink)  
Old 02-23-2009, 06:35 PM
[email protected]
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On Feb 23, 8:23*am, "Alex_001" <a.bast...@email.it> wrote:
> Hi,
> it's well known that sampling a continuous function according to the
> sampling theorem requirements, you get all the information on the
> contunuous function just from the samples.
> now, if you have to get an accurate estimate of the integral of the
> continous function from samples satisfying the sampling theorem
> requirements, how can you *get a good estimate of such an integral?
> I noticed that if you use a sampling frequency close to the Nyquist rate
> and apply the definition of integration in the time domain ( sum(Xi*
> delta(x))) the value you get for the integral is totally inaccurate...
> I hope the problem is clear...
> thanks
> Alex


Hello Alex,

There are several ways of looking at this. I assume your sampling rate
is uniform. Then if you are assuming the signal was properly
bandlimited before sampling, then your intergral is a sum of
integrals. I.e., integration is linear. So what is your interpolating
function - how do you connect the dots. Well basically for a
bandlimited thing you connect the dots with scaled sync functions. So
you need to find the integral of a sync function - well that is not
too bad. You may find it in a table of integrals if you don't know the
trick. Your overall integral is a sum of weighted (by the samples)
integrals of sync functions..

You may also connect the dots with polynomials. For equally spaced
dots you can used simple things like trapezoidal rule or Simpson's
rule. You may even fit higher order polys to the data and then find
the integral. Fortunately this has already been done so you just need
the weights provided by Newton-Cotes formulae. If you are free to pick
your sampling points and don't mind nonuniform sampling then with N
points you can come up with an integral formula that is exact of polys
up to order 2N-1. Yeap that is true. Look up Gauss Legendre
integration. You can also look up Lobatto's rule and Redeau
integration - these are all variations on a theme.

IHTH,

Clay

p.s. How long a data span do you need to integrate? How many points?





Reply With Quote
  #10 (permalink)  
Old 02-23-2009, 07:17 PM
Peter \Timmy\ Timmins
Guest
 
Posts: n/a
Default Re: integration of a continuous function

"Alex_001" <[email protected]> wrote in message
news:[email protected] ...
> it's well known that sampling a continuous function according to the
> sampling theorem requirements, you get all the information on the
> contunuous function just from the samples.
> now, if you have to get an accurate estimate of the integral of the
> continous function from samples satisfying the sampling theorem
> requirements, how can you get a good estimate of such an integral?
> I noticed that if you use a sampling frequency close to the Nyquist rate
> and apply the definition of integration in the time domain ( sum(Xi*
> delta(x))) the value you get for the integral is totally inaccurate...


Try T * (sum(Xi*delta(x))) where T is the time between samples.

Plot in on paper ..... the sample points are infinitesimallly short
but by considering each sample as lasting until the next sample,
then your integral will take on a meaningful value, subject to
any interpolation that you might like to try, such as linear (over 2
points) or quadratic (over 3 points).

Or else try out Simpson's rule.


Reply With Quote
  #11 (permalink)  
Old 02-23-2009, 07:48 PM
illywhacker
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On Feb 23, 6:18*pm, illywhacker <illywac...@gmail.com> wrote:
> On Feb 23, 4:19*pm, John <sampson...@gmail.com> wrote:
>
>
>
> > On Feb 23, 8:46*am, illywhacker <illywac...@gmail.com> wrote:

>
> > > On Feb 23, 2:23*pm, "Alex_001" <a.bast...@email.it> wrote:

>
> > > > Hi,
> > > > it's well known that sampling a continuous function according to the
> > > > sampling theorem requirements, you get all the information on the
> > > > contunuous function just from the samples.
> > > > now, if you have to get an accurate estimate of the integral of the
> > > > continous function from samples satisfying the sampling theorem
> > > > requirements, how can you *get a good estimate of such an integral?
> > > > I noticed that if you use a sampling frequency close to the Nyquistrate
> > > > and apply the definition of integration in the time domain ( sum(Xi*
> > > > delta(x))) the value you get for the integral is totally inaccurate....

>
> > > You can express the original continuous function as a linear
> > > combination of shifted sinc functions weighted by the sample values.
> > > This is the reconstruction theorem. Any integral of the original
> > > continuous function is therefore a linear combination of integrated
> > > shifted sinc functions weighted by the sample values.

>
> > > illywhacker;

>
> > Is this another way of saying interpolate by a large factor using a
> > sinc filter and then do sum(Xi*deltaX)?

>
> Yes. but the sinc function is determined by the sampling procedure and
> the maximum frequency in the original signal


Sorry: I meant sampling rate, since we are not assuming exact Nyquist
sampling.

illywhacker;
Reply With Quote
  #12 (permalink)  
Old 02-23-2009, 10:18 PM
jim
Guest
 
Posts: n/a
Default Re: integration of a continuous function



Alex_001 wrote:

> for VLV: I know the problem could be pretty trivial


It could be trivial or it could be complicated. You haven't stated the problem.
What you did was you asked for somebody to explain why your solution isn't
working. The actual problem has been left to the imagination of the user.


, but I do not work
> 100% of my time on this...and I just wanted to know if there was a esasy
> solution.
> Anyway, nobody forced you to read my thread and reply, did someone?


Believe it or not you were getting good advice.

-jim


>
> Alex

Reply With Quote
  #13 (permalink)  
Old 02-23-2009, 10:42 PM
Glen Herrmannsfeldt
Guest
 
Posts: n/a
Default Re: integration of a continuous function

Alex_001 wrote:

> Hi,
> it's well known that sampling a continuous function according to the
> sampling theorem requirements, you get all the information on the
> contunuous function just from the samples.


If you look closely, you will find that only works in the infinite
time limit. Also, it only works if the signal isn't quantized,
which they usually are by the time they get into a computer.

> now, if you have to get an accurate estimate of the integral of the
> continous function from samples satisfying the sampling theorem
> requirements, how can you get a good estimate of such an integral?


The sum of the points should be a good estimate. Quantization noise
will average out in the long term.

> I noticed that if you use a sampling frequency close to the Nyquist rate
> and apply the definition of integration in the time domain ( sum(Xi*
> delta(x))) the value you get for the integral is totally inaccurate...


I believe for a sufficiently long integration time you should get
the right answer. Sufficiently long should be such that the difference
between the sampling frequency and Nyquist rate is much larger
than 1/(integration time). That shouldn't be hard for real
signals of practical use. For a CD at 44.1kHz and 20kHz frequency
limit (40kHz Nyquist rate) that would require a time much longer
than 1/(4.1kHz) or about 0.00025s. Much longer might be 100
or 1000 times as long, so say 0.25s.

If that isn't enough, then state more details of the problem
you are actually working on.

-- glen

Reply With Quote
  #14 (permalink)  
Old 02-24-2009, 10:41 AM
illywhacker
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On Feb 23, 10:18 pm, jim <".sjedgingN0sp"@m...@mwt.net> wrote:
> Alex_001 wrote:
> > for VLV: I know the problem could be pretty trivial

>
> It could be trivial or it could be complicated. You haven't stated the problem.
> What you did was you asked for somebody to explain why your solution isn't
> working. The actual problem has been left to the imagination of the user.
>
> , but I do not work
>
> > 100% of my time on this...and I just wanted to know if there was a esasy
> > solution.
> > Anyway, nobody forced you to read my thread and reply, did someone?

>
> Believe it or not you were getting good advice.


Telling someone to use polynomial interpolation while knowing nothing
about the problem is the approach of someone who uses cookbook
solutions. While that might be OK for Abvolt Inc., it is not good
advice.

illywhacker;
Reply With Quote
  #15 (permalink)  
Old 02-24-2009, 03:03 PM
jim
Guest
 
Posts: n/a
Default Re: integration of a continuous function



illywhacker wrote:
>
> On Feb 23, 10:18 pm, jim <".sjedgingN0sp"@m...@mwt.net> wrote:
> > Alex_001 wrote:
> > > for VLV: I know the problem could be pretty trivial

> >
> > It could be trivial or it could be complicated. You haven't stated the problem.
> > What you did was you asked for somebody to explain why your solution isn't
> > working. The actual problem has been left to the imagination of the user.
> >
> > , but I do not work
> >
> > > 100% of my time on this...and I just wanted to know if there was a esasy
> > > solution.
> > > Anyway, nobody forced you to read my thread and reply, did someone?

> >
> > Believe it or not you were getting good advice.

>
> Telling someone to use polynomial interpolation while knowing nothing
> about the problem is the approach of someone who uses cookbook
> solutions. While that might be OK for Abvolt Inc., it is not good
> advice.


Oh I suppose you think that you are GOD and that your sinc function is
infinitely long and not just another polynomial. Should I take a moment to pray
or would you prefer I make a sacrificial offering?

The good advice I was referring to was this -> "Cut the bullshit. What are you
really trying to do?"

Everybody else (and you in particular) up to that point was giving bullshit
advice "while knowing nothing about the problem"

-jim


>
> illywhacker;

Reply With Quote
  #16 (permalink)  
Old 02-24-2009, 03:51 PM
illywhacker
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On Feb 24, 3:03*pm, jim <".sjedgingN0sp"@m...@mwt.net> wrote:
> illywhacker wrote:
>
> > On Feb 23, 10:18 pm, jim <".sjedgingN0sp"@m...@mwt.net> wrote:
> > > Alex_001 wrote:
> > > > for VLV: I know the problem could be pretty trivial

>
> > > It could be trivial or it could be complicated. You haven't stated the problem.
> > > What you did was you asked for somebody to explain why your solution isn't
> > > working. The actual problem has been left to the imagination of the user.

>
> > > , but I do not work

>
> > > > 100% of my time on this...and I just wanted to know if there was a esasy
> > > > solution.
> > > > Anyway, nobody forced you to read my thread and reply, did someone?

>
> > > Believe it or not you were getting good advice.

>
> > Telling someone to use polynomial interpolation while knowing nothing
> > about the problem is the approach of someone who uses cookbook
> > solutions. While that might be OK for Abvolt Inc., it is not good
> > advice.

>
> Oh I suppose you think that you are GOD and that your sinc function is
> infinitely long and not just another polynomial.


Oh dear. The point about polynomials is not that they are not dense.
It is the poor orthogonality properties, divergence, etc, etc, that
make them poor choice for many tasks. The problem is to infer the
original signal, or rather its integral. In the simplest cases, this
means inverting an operator, whatever that operator might be. Its
inverse, though, is surely not a low order polynomial, not even
qualitatively. But the cookbook can be applied, and surely will
produce reasonable results.

illywhacker;
Reply With Quote
  #17 (permalink)  
Old 02-24-2009, 05:35 PM
[email protected]
Guest
 
Posts: n/a
Default Re: integration of a continuous function

On Feb 23, 4:42*pm, Glen Herrmannsfeldt <g...@ugcs.caltech.edu> wrote:
> Alex_001 wrote:
> > Hi,
> > it's well known that sampling a continuous function according to the
> > sampling theorem requirements, you get all the information on the
> > contunuous function just from the samples.

>
> If you look closely, you will find that only works in the infinite
> time limit. *Also, it only works if the signal isn't quantized,
> which they usually are by the time they get into a computer.
>
> > now, if you have to get an accurate estimate of the integral of the
> > continous function from samples satisfying the sampling theorem
> > requirements, how can you *get a good estimate of such an integral?

>
> The sum of the points should be a good estimate. *Quantization noise
> will average out in the long term.
>
> > I noticed that if you use a sampling frequency close to the Nyquist rate
> > and apply the definition of integration in the time domain ( sum(Xi*
> > delta(x))) the value you get for the integral is totally inaccurate...

>
> I believe for a sufficiently long integration time you should get
> the right answer. *Sufficiently long should be such that the difference
> between the sampling frequency and Nyquist rate is much larger
> than 1/(integration time). * That shouldn't be hard for real
> signals of practical use. *For a CD at 44.1kHz and 20kHz frequency
> limit (40kHz Nyquist rate) that would require a time much longer
> than 1/(4.1kHz) or about 0.00025s. *Much longer might be 100
> or 1000 times as long, so say 0.25s.
>
> If that isn't enough, then state more details of the problem
> you are actually working on.
>
> -- glen


Hello Glen,

The sum of the points is pretty close. But a simple correction gets
you closer. Just sum all of the interior points plus add in 1/2 of the
first and last point. The final sum should be scaled by sampling
period (or divided by the sampling rate). This falls out from the
integral of the scaled sync function. The error caused by tails of the
omitted data (data outside of the integration interval) can be diluted
down by taking more samples within the interval via a higher sampling
rate, but the general approach gives a pretty good estimate.

Of course the OP hasn't given detail about his problem so how good is
good enough for his needs? But I think he, like a lot of people, need
to experiment with this and learn more about the problem at hand and
then be able to specify his problem. Our generic suggestions give him
some things to try.

Clay









Reply With Quote
  #18 (permalink)  
Old 02-24-2009, 05:48 PM
Vladimir Vassilevsky
Guest
 
Posts: n/a
Default Re: integration of a continuous function



Glen Herrmannsfeldt wrote:

> Alex_001 wrote:
>


>> now, if you have to get an accurate estimate of the integral of the
>> continous function from samples satisfying the sampling theorem
>> requirements, how can you get a good estimate of such an integral?

>
> I believe for a sufficiently long integration time you should get
> the right answer. Sufficiently long should be such that the difference
> between the sampling frequency and Nyquist rate is much larger
> than 1/(integration time).


Good point. The impact of the oscillating components into the integral
falls like 1/t.

VLV


Reply With Quote
  #19 (permalink)  
Old 02-24-2009, 06:51 PM
Alex_001
Guest
 
Posts: n/a
Default Re: integration of a continuous function

Here's my problem:

we're aquiring a signal form a piezoelectric force sensor; the analo
signal is filtered by a lowpass filter at 5 kHz and sampled at 100 kHz. I
such a way we get a "smooth" waveform, that is what we want.

What we need is to calculate the integral of this signal, on a 5 m
window.
I was wondering if there's a EASY way to reduce the sampling frequency an
still get an accurate estimate (there are surely ways to do that, but i
too compicated is useless for our application, we'd rather have a highe
sampling frequency).

Following illywhacker's (and someoneelse's) advice, I wrote my continuou
function as a linear combination of shifted sinc functions weighted by th
sample values (recostruction theorem).
Denoting with X(t) the continuous function, and X(n*T) it samples in [0
To], I got for the integral in [0 T0] (N = total number of samples):

integral[0 , T0]{X(t)dt} = sum[n=0..N]{X(nT)* integral[-n
(T0-nT)/T]{sinc(p)dp}}

Now, the function integral[0 , x]{sinc(x)dx} is known and tabulate (Matla
implements such a function, for example). So, if my procedure was correct
it should be not that hard...I will try and let you know.

Alex

Reply With Quote
  #20 (permalink)  
Old 02-24-2009, 07:14 PM
Vladimir Vassilevsky
Guest
 
Posts: n/a
Default Re: integration of a continuous function



Alex_001 wrote:
> Here's my problem:
>
> we're aquiring a signal form a piezoelectric force sensor; the analog
> signal is filtered by a lowpass filter at 5 kHz and sampled at 100 kHz. In
> such a way we get a "smooth" waveform, that is what we want.
>
> What we need is to calculate the integral of this signal, on a 5 ms
> window.
> I was wondering if there's a EASY way to reduce the sampling frequency and
> still get an accurate estimate


What could be simpler then a moving average filter?

> Following illywhacker's (and someoneelse's) advice, I wrote my continuous
> function as a linear combination of shifted sinc functions weighted by the
> sample values (recostruction theorem).


Extra knowledge is harmful to the idiots.

> Now, the function integral[0 , x]{sinc(x)dx} is known and tabulate (Matlab
> implements such a function, for example).


"Matlab does all thinking for us" (TM)

VLV
Reply With Quote
  #21 (permalink)  
Old 02-24-2009, 07:30 PM
jim
Guest
 
Posts: n/a
Default Re: integration of a continuous function



Alex_001 wrote:
>
> Here's my problem:
>
> we're aquiring a signal form a piezoelectric force sensor; the analog
> signal is filtered by a lowpass filter at 5 kHz and sampled at 100 kHz. In
> such a way we get a "smooth" waveform, that is what we want.


Keep in mind the sensor has a frequency response that approximates force in a
certain range of frequencies. For instance it may be from 20 to 20KHz the
response is more or less linear with the square of the frequency. How the sensor
is mounted affects this frequency response. So you can only accurately determine
the response in situ.

>
> What we need is to calculate the integral of this signal, on a 5 ms
> window.


What you should consider is using a filter that is inverse of the frequency
response of your system. That will look a lot like integration.


> I was wondering if there's a EASY way to reduce the sampling frequency and
> still get an accurate estimate (there are surely ways to do that, but if
> too compicated is useless for our application, we'd rather have a higher
> sampling frequency).


Is higher frequency above the point where the sensors response is no longer
linear with the frequency squared?

-jim


>
> Following illywhacker's (and someoneelse's) advice, I wrote my continuous
> function as a linear combination of shifted sinc functions weighted by the
> sample values (recostruction theorem).
> Denoting with X(t) the continuous function, and X(n*T) it samples in [0,
> To], I got for the integral in [0 T0] (N = total number of samples):
>
> integral[0 , T0]{X(t)dt} = sum[n=0..N]{X(nT)* integral[-n ,
> (T0-nT)/T]{sinc(p)dp}}
>
> Now, the function integral[0 , x]{sinc(x)dx} is known and tabulate (Matlab
> implements such a function, for example). So, if my procedure was correct,
> it should be not that hard...I will try and let you know.
>
> Alex

Reply With Quote
  #22 (permalink)  
Old 02-24-2009, 08:11 PM
Alex_001
Guest
 
Posts: n/a
Default Re: integration of a continuous function

>

>
>What could be simpler then a moving average filter?
>


it's not what we need..our acquisitions are on a 5 ms windows a
different time instants (when particoular events occur)

>
>
>Extra knowledge is harmful to the idiots.


not everybody can spend all his time reading posts and insultin
people..someone has also to work.


>"Matlab does all thinking for us" (TM)



what I need is EXACTLY a cookbook solution...I am not a geniuos like you.
(and I cited Matlab just as an example).

what's the problem with you man?
Chill out!

>
>VLV
>

Reply With Quote
  #23 (permalink)  
Old 02-24-2009, 08:58 PM
Glen Herrmannsfeldt
Guest
 
Posts: n/a
Default Re: integration of a continuous function

[email protected] wrote:
(someone wrote)

>>>it's well known that sampling a continuous function according to the
>>>sampling theorem requirements, you get all the information on the
>>>contunuous function just from the samples.

(big snip including things I wrote)

> The sum of the points is pretty close. But a simple correction gets
> you closer. Just sum all of the interior points plus add in 1/2 of the
> first and last point. The final sum should be scaled by sampling
> period (or divided by the sampling rate). This falls out from the
> integral of the scaled sync function. The error caused by tails of the
> omitted data (data outside of the integration interval) can be diluted
> down by taking more samples within the interval via a higher sampling
> rate, but the general approach gives a pretty good estimate.


It is well known that sampling at half the frequency of a sine
doesn't give the right result. Now, consider a short sampling
interval, a sine close to half the sampling rate, and the sine
crossing zero near the middle of the interval. The other samples
won't be at zero, but they will be very close.

It is commonly ignored, but perfect reconstruction below the
Nyquist frequency really depends on an infinite interval.
For most real problems the interval is sufficiently long that
it doesn't cause problems. As I said in my previous post,
for a CD 0.25s is plenty long enough. I believe the minimum
for a CD track is something like 3 or 4 seconds.

> Of course the OP hasn't given detail about his problem so how good is
> good enough for his needs? But I think he, like a lot of people, need
> to experiment with this and learn more about the problem at hand and
> then be able to specify his problem. Our generic suggestions give him
> some things to try.


More details would be nice. I came up with the one case I could
think of where integrating the points would not give the right
answer.

-- glen

Reply With Quote
  #24 (permalink)  
Old 02-24-2009, 09:24 PM
Jerry Avins
Guest
 
Posts: n/a
Default Re: integration of a continuous function

Glen Herrmannsfeldt wrote:
> [email protected] wrote:
> (someone wrote)
>
>>>> it's well known that sampling a continuous function according to the
>>>> sampling theorem requirements, you get all the information on the
>>>> contunuous function just from the samples.

> (big snip including things I wrote)
>
>> The sum of the points is pretty close. But a simple correction gets
>> you closer. Just sum all of the interior points plus add in 1/2 of the
>> first and last point. The final sum should be scaled by sampling
>> period (or divided by the sampling rate). This falls out from the
>> integral of the scaled sync function. The error caused by tails of the
>> omitted data (data outside of the integration interval) can be diluted
>> down by taking more samples within the interval via a higher sampling
>> rate, but the general approach gives a pretty good estimate.

>
> It is well known that sampling at half the frequency of a sine
> doesn't give the right result. Now, consider a short sampling
> interval, a sine close to half the sampling rate, and the sine
> crossing zero near the middle of the interval. The other samples
> won't be at zero, but they will be very close.
>
> It is commonly ignored, but perfect reconstruction below the
> Nyquist frequency really depends on an infinite interval.
> For most real problems the interval is sufficiently long that
> it doesn't cause problems. As I said in my previous post,
> for a CD 0.25s is plenty long enough. I believe the minimum
> for a CD track is something like 3 or 4 seconds.
>
>> Of course the OP hasn't given detail about his problem so how good is
>> good enough for his needs? But I think he, like a lot of people, need
>> to experiment with this and learn more about the problem at hand and
>> then be able to specify his problem. Our generic suggestions give him
>> some things to try.

>
> More details would be nice. I came up with the one case I could
> think of where integrating the points would not give the right
> answer.


What is the "right answer" when the sample encompass only a small part
of the longest period?

Jerry
--
Engineering is the art of making what you want from things you can get.
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
Reply With Quote
  #25 (permalink)  
Old 02-24-2009, 09:56 PM
Glen Herrmannsfeldt
Guest
 
Posts: n/a
Default Re: integration of a continuous function

Jerry Avins wrote:
(snip, I wrote)

>> It is well known that sampling at half the frequency of a sine
>> doesn't give the right result. Now, consider a short sampling
>> interval, a sine close to half the sampling rate, and the sine
>> crossing zero near the middle of the interval. The other samples
>> won't be at zero, but they will be very close.

(snip)

> What is the "right answer" when the sample encompass
> only a small part of the longest period?


Yes. Well, if you believe in perfect reconstruction you know
what the right answer is. (The signal you sampled in the
first place.)

But it isn't only part of the longest period, it is only in
the sampled signal that it is part of the long period.

The signal makes almost one half cycle between sample points.
With infinite samples you can extract it exactly. With a
large number of samples you can extract it pretty well.
With a small number, even many periods of the original
signal, you can't.

Another way to say it is that the sample interval must be long
enough for the reconstruction filter to process. As you get
closer to the Nyquist frequency, the reconstruction filter
needs more time.

-- glen

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
SystemVerilog Interface style (managing continuous and non-continuous assignments) Andrew Burnside Verilog 3 07-05-2007 10:06 AM
Euler integration Jhoberg DSP 1 03-26-2007 05:30 AM
ise and edk integration Shakith FPGA 0 11-02-2004 06:35 PM
any linear function is continuous, right? Joenyim Kim DSP 6 02-04-2004 12:24 PM
integration/differentiation in DSP Toby Newman DSP 1 07-02-2003 03:32 PM


All times are GMT +1. The time now is 02:35 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved