Originally Posted by

**Chazed** Hey there people! This will probably be easy for you.. But not for me! I am new to the program MATLAB (reading a course where I have to use it). I´ve been googling some and tried other ways to get help, but without results.

**I want to make an M-file that ****calculates the definite integral of ∫x3 dx in the interval 3 – 1.**

All help is appriciated!

Regards, Chazed.

Midpoint rule:

Code:

dx=0.001;
x=1+dx/2:dx:3
ii=x.^3;
II=sum(ii)*dx;

and if you really mean to do the integral from 3 to 1 the answer is minus the above.

CB