MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayNew to MATLAB?
MATLAB Central > MATLAB Newsreader > help cumtrapz 

I want to integrate a function using cumtrapz function as I want to have values of the integral at intermediate steps. The function is sin(1x) with x as an integration variable ranging from 0 to 1. I have noticed that cumtrapz function doesn't do the integration correctly. One can check it by plotting the values obtained from cumtrapz function versus the values obtained from the analytical formula (1cos(x) in this case). I figured out myself how to make cumtrapz work for this function. But I don't find any general method to make cumtrapz work for other functions e.g. x sin(1x). I should mention usually cumtrapz works fine for general functions. However, for integrals that have upper limit of integration appear in the arguments of integrands (for trigonometric functions), it doesn't work. Has anyone faced such problems before? Please let me know. I have evaluated this integral by 

"Steven Lord" <slord@mathworks.com> wrote in message <hj4jeq$t3o$1@fred.mathworks.com>... 
I made a GUI for numeric integration using simpson and trapezoidal methods with matlab functions and my own functions, it also draws functions and shows the method, if there are enough people interested I might upload it to file exchange, here's what the GUI looks like (it's in my own language but I can change it to english) 
"pietro " <bracardi82@email.it> wrote in message <ido99p$dd0$1@fred.mathworks.com>... 
"John D'Errico" <woodchips@rochester.rr.com> wrote in message <idod46$1of$1@fred.mathworks.com>... 
"pietro " <bracardi82@email.it> wrote in message <idoe5t$a9h$1@fred.mathworks.com>... 
"John D'Errico" <woodchips@rochester.rr.com> wrote in message <idof94$mdg$1@fred.mathworks.com>... 
Paulo, 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.