Help with MATLAB and a variation of the trapezium rule
Hi I'm having some difficulty with a problem I've been set:
A modified form of the trapezium rule for calculating the area under a curve makes use of strips
of varying width: by using narrower strips where the gradient varies more rapidly, better
accuracy can be achieved. Create a function to perform the integral
integral of (1/x dx) between 1 and 101
using the trapezium rule with strips that increase geometrically in width, such that,
where Δxn is the width of the nth strip and r is a constant (which is an
input to the function).
Choose the value of Δx1 to give a total of 100 strips for any value of r (hint: you will need the
formula for the sum of a geometric progression to calculate Δx1).
I'm not really sure how to define Δx1. After I can do that I guess you just make a function and define n=[1:1:101], Δxn=Δx1*r^(n-1), y=1/Δxn and then trapz(Δxn,y) or something along those lines. Any help would be very much appreciated. (forgive me, I'm not familiar with the codes to present the information more clearly here).