Search code examples
matlabnumerical-integration

compute definite integral in Matlab


i have the data below

Three Columns[X,Y,Z

the columns are X,Y and Z

i want to compute this Integral

enter image description here

i don't know how to do it in matlab

i searched and didn't find any case like my problem with the integration limits are array values,the variables are also arrays. and i really don't know how to solve it mathematically i tried solving ,but the Y,Z and X being arrays with double values is not making things easy


Solution

  • You can do the following if you store X, Y and Z in MATLAB:

    fyz = Y*(Z - 25);
    
    % Compute the integral
    I = trapz(fyz, X);