Matlab integral not giving right result as trapz function
Mostrar comentarios más antiguos
I have the following code
x = 0:0.1:1;
y = x.*x;
dy = gradient(y);
dx = gradient(x);
dx_fun = @(z) spline(x,dx,z);
dy_fun = @(z) spline(x,dy,z);
integral(dy_fun,0,1)
trapz(dy_fun(x))
the result obtained by the integral function does not match the result obtained by trapz function. Both bounds of the intergation are the same for both function. Value of trapz(dy_fun(x)) = y(end,1)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Numerical Integration and Differentiation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!