Trapezium and Simpson's Rule, plotting graphically

1 view (last 30 days)
I have 3 tasks, to plot the rectangle, trapezium and simpson's rule.
For the rectangle rule, I've produced an array of x0:h:x1 where x0 and x1 are the upper and lower limits, and h is the strip width. I used a simple histogram method here, but I'm stuck for how to produce trapeziums, and how to then change the straight lines of the trapeziums to parabolas to suit the Simpson's rule.
Any help would be greatly appreciated.
I have another question concerning how to add numerical data to a subplot (4 graphs in a 2x3 array with 3 and 6 empty for the data I require.) I'll put this in a question of it's own too as it may be clearer.

Answers (1)

Sean de Wolski
Sean de Wolski on 19 Apr 2012
doc trapz %or cumtrapz
What have you done thus far for simpson's rule?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!