Matlab integral not giving right result as trapz function
Ältere Kommentare anzeigen
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)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!