LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to set or initialize the integration constant in integral x(t).vi

 


 

Nitzz wrote:

 

I think what Jhonsold told is correct. Kindly have a look on the attached VI.

 


 

 thanx but your vi is not working ....

i am using labview 2009

which version r u guys using... is that an issue??

0 Kudos
Message 11 of 22
(982 Views)

Hi,

 

This VI is in 2009

 

Regards,


Nitzz

(Kudos are always Welcome, Mark as a solution if it is the One;))

0 Kudos
Message 12 of 22
(979 Views)

hey nitzz .... i dont know wat is the need of all that...

my original vi just works fine wen it comes to extracting the data from the text file and plotting the graph..

my only problem is the integration part...

if anyone could answer my original question: how to correctly integrate the given data

     and also how to set the integration constant? 

0 Kudos
Message 13 of 22
(975 Views)

I can't answer your original question "how to correctly integrate the given data and also how to set the integration constant?" but I think I know what the problem is.

 

I was able to read and plot your data.  The sinewave plotted is negative (except for the peaks which are zero).  Integrating the curve calculates the area between the curve and the x-axis.  Since your data is always negative, the area is is increasingly negative , thus the squiggly line trailing down.  If you calculate and subtract the mean of your sinewave, i.e.. shift its baseline up to zero and then integrate, the result is more like what you expect  -cosine.

 

It's the joy of real world numerical integration versus theoretical mathematical integration.  Unfortunately I have to use differential sensors on regular basis, the output of which has to be integrated to be meaningful.  I have yet to find a way to perform the integration reliably.   Most of my data is impulses so I know approximately what the initial and final condition should be and adjust the baseline accordingly.  Scale is a different matter.  Numerical integrations will need a scale factor.  Once of my sensors includes the scale factor, but most are homemade and the scale factors are derived my measuring known signals and adjusting accordingly.

 

A couple of comments on your VI.  For whatever reasons, most likely regional settings, I had to use format string or every thing was zero.

Also, you are plotting your Time and Y data against the x-axis, which is samples not time.

Message 14 of 22
(962 Views)

hey thanx ctf for the reply....

But how do i calculate the mean of one cycle of the wave??

0 Kudos
Message 15 of 22
(947 Views)

--> But how do i calculate the mean of one cycle of the wave??

 

I just ran your sample data through the MEAN function.  A single cycle is a bit more challenging.  Since your sample data is rather clean you can probably extract a single cycle by identifying the mins (or maxs) as the start and end point of a single cycle.  Or average the min and max of a cycle.  The necessary voodoo will depend on what your actual data is. 

 

I'm not smart enough to answer your original question.  In my experience what might work for one dataset is useless on the next and visa versa.  The most reliable method I've found is looking at the data and manually adjusting the baseline till it looks 'right', e.g. if the integration tails up shift the baseline of the original waveform down, if the integration tails down, shift the baseline up.

 

 

 

0 Kudos
Message 16 of 22
(936 Views)

hey i calculated the mean, subtracted it from the data and thus shifted the baseline and then integrated it....

but i am juss gettin a straight line coinciding with the x-axis, ie. 0 ... maybe as u said integrating calculates the area between the curve and the x-axis.. the net area here is zero.... how did u get a -cosine wave??

0 Kudos
Message 17 of 22
(928 Views)

It's probably not zero, just very small values.  Is the integral still plotted on the same graph as your time values?  If so the time values expand the Y-axis so the integral is lost in the noise (Graph 3).  If you plot the integral by itself you can see it (Gragh 4)

Picture3.png

Message 18 of 22
(922 Views)

hehe all this while i was getting the integral... but was plotting it wrong..

i should have paid attention to your previous comment on my vi, that am plotting time and voltage against the x-axis..

Anyways.... any idea y after integrating, there is a decrese in the amplitude.... integration shouldnt affect that.. does it??

0 Kudos
Message 19 of 22
(906 Views)

The scaling comes about because :

0056.png

The catch is that 'x' is in radians and you never have a frequency such that a single cycle = 2*PI.  You have to figure out what 'a' is so that when multiplied by the period/# of points per cycle/frequency/(?) it equals PI (or maybe 2*PI?).

 

0 Kudos
Message 20 of 22
(897 Views)