Can anyone solve this using the trapezoid method and no built in functions on Matlab?
- I'm StupidLv 62 weeks ago
nLoop = length(x) - 1; %Because we are dealing with sequence we subtract 1 from the total length
work = 0; % for summation purpose
for ii = 1:nLoop
jj = ii + 1;
work = work + (Force(ii)*x(ii)+Force(jj)*x(jj))/2*(x(jj)-x(ii)); %See Non-uniform grid in wiki
work %Shows answer