I'm not very good with matlab and have been trying to get some practice in over the summer. Ive just about managed to write an M-file for the trapezium rule and was just wondering how I could modify it and set a tolerance level.
This is what ive got so far:
sum = 0;
x(i)=a + i*h;
sum = sum + f(x(i));
I = h*(f(a)+f(b)+2*sum)/2
So i can use it for n strips but im not sure how to make it run for increasing strips :S
Can anyone help me out at all? Thanks