From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple cosine integration

Solved!
Go to solution

i am testing integration in LabVIEW full 2010 with the 1D numeric integration VI.  attached is the sample VI wherein a cosine waveform is pulled apart and fed into a 1D numerical integration VI.  i only feed in the first quater of the array because i only want the integration from 0 to pi/2.  the integral should be 1, but the VI returns .0159.  i don't get that.  what am i missing?  thank you in advance and have a great day.  lucas

0 Kudos
Message 1 of 5
(4,208 Views)

What you are about to read is based on pure speculation on my part, I do not have LV10 to open your VI.  I'll guess the source of your problem is the units of time.

 

You expect to be integrating cos(x)dx from 0 to Pi/2.  Instead you are integrating cos(2pi*f*t)dt from 0 to 1/4f.  You are seeing the factor of 1/(2pi*f), and I'll wager you chose the frequency of the cosine to be 1/10 of the sampling frequency.

 

 

0 Kudos
Message 2 of 5
(4,195 Views)

i don't think so because i have included an array output to verify the 1/4 subset to the integral.  it starts at 1 and gently slopes down to almost 0, which is what cosine does from 0 to pi/2.  so i think the array input into the integral is verifiably correct.

0 Kudos
Message 3 of 5
(4,192 Views)

You will have to post an image of your code.  I am guessing that your 'dt' is not what you expect, and that you are feeding the waveform dt into the numerical integration routine.

0 Kudos
Message 4 of 5
(4,184 Views)
Solution
Accepted by topic author slucas

You dX for the integration is pi/2/250.  You want to go from 0 to pi/2.  And each section of that is 1/250th of a sample.

 

So wire in (pi/2)/250 instead the dT from your waveform info, and you will get 1.

 

Read the help for the numeric integration function.  dt is interval size.  Not timing like it is for a waveform.

 

EDIT:

I see Darin already picked up on the problem while I was investigating and typing.  Like I said, read the detailed help for the integration function.

Your interval is dT of the waveform timing which is .0001.  The actual interval size as you want it to be is 1/250th of pi/2.

 

 

0 Kudos
Message 5 of 5
(4,183 Views)