Page 1 of 1

8. (10 pts) The following Matlab code should yield an O(ha) finite difference derivative approximation at each point r.

Posted: Sat May 14, 2022 7:31 pm
by answerhappygod
8 10 Pts The Following Matlab Code Should Yield An O Ha Finite Difference Derivative Approximation At Each Point R 1
8 10 Pts The Following Matlab Code Should Yield An O Ha Finite Difference Derivative Approximation At Each Point R 1 (68.88 KiB) Viewed 35 times
8. (10 pts) The following Matlab code should yield an O(ha) finite difference derivative approximation at each point r. The given data input for the function is z, y where a contains the r-values of the data and y contains the y-values of the data. For each step in the loop use the most appropriate O(ha) finite difference formula assuming the c-data values are equally spaced. Fill in the blanks function Cyprime] = FiniteDifference0h2(x,y) %x is the x-data vector, assume the x values are equally spaced. %y is the y-data vector if (length(y) *= length(x)) error('data vectors must be the same length') end n = length(y); yprime = zeros(1,n); h = = for i=1:n if i==1 yprime(__) elseif i==n yprime(__) else yprime() end end end