calling gradient multiple times
Mostrar comentarios más antiguos
MATLAB suggests not to call gradient multiple times, but I did it for sin function. As shown in the figure, the first order derivative is fine, the second has one boundary point off, and the third two points off. I really appreciate if someone can quantatively explain it from the mathematical point of view.
h = .1; % time step
t = 0:h:10; % time array
y = sin(t); % sin function
dy = gradient(y,h);
ddy = gradient(dy,h);
dddy = gradient(ddy,h);
plot(t,[y;dy;ddy;dddy]);

Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Object Analysis 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!


