I was wondering how to use the Trapezoidal Rule in C++. My homework states this:
Write a program to integrate an arbitrary time-‐domain signal, with a variable sample interval and variable limits of integration. Test your program on a simulated time-‐domain signal.
So far, I have this for my code:
float result, x,y[imax];
I'm just a beginner, so any ideas at all would be greatly appreciated.
"((Left(n)+right(n))/2)" Where the left and right are both upper and lower estimates of the area under a curve via riemann sums.
You must incorporate the information points including a data value "x,y" and need to have a set table of values for x,y. After that you can plug it in then work it through c++. Try to take what I just wrote and do it out regularly, then try to figure it's code. Hopefully this helps.