Need help starting this code!!! Arrays

1 view (last 30 days)
Hudson Harrell
Hudson Harrell on 14 Nov 2020
Answered: madhan ravi on 14 Nov 2020
I have 2 array for example x=[0 1 2 3 4 5 6 7 8 9 10] and f=[10 11 12 13 14 15 16 17 18 19 20] that are given, that I need to plug into the formula for foward, backward, and central differencing. The formula for Forward differencing is f'(xi)=(f(xi+1)-f(xi))/h, Backward f'(xi)=(f(xi)-f(xi-1))/h, and central f'(xi)=(f(xi+1)-f(xi-1))/2h, and the step size is h=1, 2. I was thinking of approaching this using a loop but i'm really unsure where to start. I get really lost when trying to create any type of loops hence why I don't have any code to provide to start with. Any advice would be great and helpful.

Answers (1)

madhan ravi
madhan ravi on 14 Nov 2020

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!