calling gradient multiple times
Afficher commentaires plus anciens
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]);

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Object Analysis dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


