04-07-2010 09:18 PM
Hi all,
I need advice and guidance on how to integrate the following function with respect to r:
I am not at all sure what approach to take and what VIs to use to solve the integral.
Thanks,
Battler.
04-07-2010 10:26 PM
04-07-2010 11:50 PM - edited 04-07-2010 11:53 PM
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.
04-08-2010 06:10 AM
04-08-2010 08:45 AM
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
04-08-2010 08:57 AM
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
04-08-2010 09:19 AM - edited 04-08-2010 09:21 AM
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??
04-08-2010 09:35 AM
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.
04-08-2010 09:40 AM
04-08-2010 11:29 AM
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