Using forward finite difference scheme to find first and second derivative given data points

3 vues (au cours des 30 derniers jours)
Im struggling to figure out how to code this. If i had the data points
time(f)=[0,2,4,6,8,10,12,14,16]; position(f(t))=[0,0.7,1.8,3.4,5.3,6.2,7.3,8,8.4]; and h=2 using forward finite difference equations dfdx=f(i+1)-f(i)/h; dfdx2=f(i+2)-2*f(i+1)+f(i)/h^2;
how would I code it so that when I wanted to know the derivative at a user entered time for example at t=10 (which would be i=6) it would run for the first derivative using the equation dfdx=f(i+1)-f(i)/h;
dfdx=7.3-6.2/2 =0.55
not sure how to implement the finite equations to calculate this for any t that is entered. Just looking for a simple way to to this. Thank you!

Réponses (0)

Catégories

En savoir plus sur Dynamic System Models dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by