Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Gregory Vainberg (http://www.vbnumericalmethods.com) for this perfect
solution. I have tested it with FlexPro and the value correlates. Cheers WayneL Hey Wayne, I have a number of different methods that you can use, but the easiest technique is trapezoidal integration. On the website I have a version that takes the function name as a parameter, but it can be easily adapted to use 2 vectors as parameters as follows: Public Function TRAPnumint(x, y) As Double n = Application.Count(x) TRAPnumint = 0 For t = 2 To n TRAPnumint = TRAPnumint + 0.5 * (x(t) - x(t - 1)) * (y(t - 1) + y(t)) Next End Function Where x is the column of x values and y is the column of f(x) values. Hope this helps, Gregory Vainberg http://www.vbnumericalmethods.com "WayneL" wrote in message ... Hi I have built a spreadsheet that can calculate the area under a curve of a set of data but I would like to have this in VBA for Excel, in say Integral(C1,C2) format or a button on the toolbar. Can anyone point me in the right direction for acquiring the code? Cheers WayneL "WayneL" wrote in message ... Hi I have built a spreadsheet that can calculate the area under a curve of a set of data but I would like to have this in VBA for Excel, in say Integral(C1,C2) format or a button on the toolbar. Can anyone point me in the right direction for acquiring the code? Cheers WayneL |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I use integration to work out the area under a curve? | Excel Worksheet Functions | |||
How to determine the area under a curve (integration) in Excel? | Charts and Charting in Excel | |||
Integration/area under a curve VBA code? | Excel Worksheet Functions | |||
Integration/area under a curve VBA code? | Excel Discussion (Misc queries) | |||
how do I caculate the area of a chart (integration)? | Charts and Charting in Excel |