Hi All, I would like an answer checked that I have found for the following problem. using Have I solved this correctly? I have tried to chack this in matlab with the code below but I am not getting this answer which now I am not sure which is incorrect. X = 0:0.5:1; Y = 5*(1./X.^2) Z = trapz(X,Y) Thanks for your time
I think you are supposed to use more than a single trapezoid to approximate the integral. Did you really think one would do the trick?
Plus your matlab code isn't correct. For three terms it would be something like .... [I don't use Matlab] X=0:0.5:1 Y=[5 5 5]./(1+X^2) ---- you missed the addition in your post Z=trapz(X,Y) So to compare values for three terms, your pencil & paper method should have the sum of two trapezoidal approximations with limits from [0 to 0.5] and [0.5 to 1] As Papbravo implies you should probably use several terms to come up with a good approximation to the 'exact' integral. With 11 terms X=[0 0.1 0.2 .... 1.0] I get a value of Z=3.9249075