LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

numerical integration of function - help

Hi all,

 

I need advice and guidance on how to integrate the following function with respect to r:

 

numerical integral.JPG

 

I am not at all sure what approach to take and what VIs to use to solve the integral.

 

Thanks,

 

Battler. 

 

 

 

0 Kudos
Message 1 of 11
(5,231 Views)
I'd be surprised and exceptionally impressed if this could be done in LabVIEW. A while back, figuring I'd run into these sorts of things every now and then, I bought the home version of Mathematica. Every now and then turned out to be pretty much never, but you might want to try the online symbolic integrator at http://integrals.wolfram.com/index.jsp
0 Kudos
Message 2 of 11
(5,217 Views)

Of course LV can solve it!

 

To solve the integral part of the equation I should:

 

1. Build the equation r.sin-1(2b/(R1+R2)).

 

2. Sample the equation over regular intervals from 0 to b (=0.08).  Replacing variable r with these values, since that is the variable we are integrating with respect to.

 

Is this correct??

 

I have attached a VI which attempts to do this.

Message Edited by battler. on 04-07-2010 11:53 PM
0 Kudos
Message 3 of 11
(5,205 Views)
Ah, my misunderstanding. I thought you were trying to integrate the function symbolically.
0 Kudos
Message 4 of 11
(5,183 Views)

battler,

 

The values you specify for n, hs, and b result in negative values for the argument of the square root in the formula for R1.  Do you have alternatives which result in real numbers?

 

If this is something you will compute many times, pull the controls outside the loop and pre-calculate things like (2*n*hs)^2 which will not change while the loop is iterating.

 

Lynn 

Message 5 of 11
(5,168 Views)

Ah ic.  That is why Nan?

 

The range of values for the variables are:

 

n - 1 to inifinity

 

hs - 0 to 0.3

 

b = 0.08

0 Kudos
Message 6 of 11
(5,165 Views)

Suppose I have values which don't produce sqrt of negative number..

 

Make b = 80 for example.  That produces a nice curve - just not sure if it's the right one.

 

Am I theoretically going about this correctly to solve the integral??

Message Edited by battler. on 04-08-2010 09:21 AM
0 Kudos
Message 7 of 11
(5,151 Views)

The source (a paper) of the Equation was wrong for R1.

 

I have attached the fixed VI.  Am I doing this right?

 

What next?  How to integrate?

 

Thanks.

0 Kudos
Message 8 of 11
(5,145 Views)
This is the problem with usi a workmates PC!
0 Kudos
Message 9 of 11
(5,140 Views)

It looks like y is the function to be integrated.  Are you going to use one of the built in Integral VIs with it?

 

The attached VI is how I have implemented the function.  By using a while loop and specifying dr rather than N, it is more like the usual mathematical approach to integration.  Anything which does not change during the calculation is moved outside the loop.  (No need to calculate (2*n*hs)^2 a thousand times with the same values!)

 

Lynn 

Message 10 of 11
(5,121 Views)