I need to perform element by element subtractions within a matrix.
1 view (last 30 days)
I have a 21x2 matrix for a given row say row 12, I need to calculate the errors by using the following numerical schemes; backwards - ((y(12)-y(11)/x(12)-x(11)), forwards - (y(13)-y(12))/(x(13)-x(12), and central (y(13)-y(11))/(x(12)-x(11)). My program needs to use matrix based calculations to solve for each element of the matrix. The following code works for the forward but I cant get the backwards or central working.
yn = y(1:length(y)-1);
xn = x(1:length(x)-1);
Thanks for the help