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

조회 수: 3 (최근 30일)
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!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Dynamic System Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by