8. (10 pts) The following Matlab code should yield an O(ha) finite difference derivative approximation at each point r.
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
8. (10 pts) The following Matlab code should yield an O(ha) finite difference derivative approximation at each point r.
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!