LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Integration/area under a curve VBA code?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I use integration to work out the area under a curve? Penfold1981 Excel Worksheet Functions 3 September 18th 07 11:01 PM
How to determine the area under a curve (integration) in Excel? Hawkeye Charts and Charting in Excel 1 November 11th 06 10:21 AM
Integration/area under a curve VBA code? WAYNEL Excel Worksheet Functions 8 May 20th 06 11:48 PM
Integration/area under a curve VBA code? WAYNEL Excel Discussion (Misc queries) 0 January 1st 06 10:02 PM
how do I caculate the area of a chart (integration)? Massoud Charts and Charting in Excel 1 May 14th 05 02:39 AM


All times are GMT +1. The time now is 06:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"