function res solveIntegraldx Use MATLAB to write a function

function res = solveIntegral(dx)

Use MATLAB to write a function called solveIntegral that takes a user defined Deltax as its input and returns the result, i.e. the numerical approximation resulting from the computation. If the input dx cannot evenly increment from 1 to 2 (e.g. dx = 0.15), you may round to the nearest number of increments (e.g. dx = 0.15 has 6.67 increments which rounds to 7 increments or dx = 1/7). function res = solveIntegral(dx)

Solution

function res = solveIntegral( dx )
%   Detailed explanation goes here
increment = 1/dx;

increment = ceil(increment);
dx = 1/increment;

res=0;
for i=1:dx:2
    res = res + sin(i)*dx/i;
end

end

function res = solveIntegral(dx) Use MATLAB to write a function called solveIntegral that takes a user defined Deltax as its input and returns the result, i.e.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site