code
solution
%output
%copyable code
%matalb code
%Derivative.m
function [back_Difference,central_Difference,forward_Difference]=Derivative(anon_Function,xmin,xmax,xinc)
back_Difference=(anon_Function(xmin:xinc:xmax)-anon_Function(xmin-xinc:xinc:xmax-xinc))/xinc;
central_Difference=(anon_Function(xmin+xinc:xinc:xmax+xinc)-anon_Function(xmin-xinc:xinc:xmax-xinc))/(2*xinc);
forward_Difference=(anon_Function(xmin+xinc:xinc:xmax+xinc)-anon_Function(xmin:xinc:xmax))/xinc;
end
%main.m
anon_Function = @(x) x.^3
xmin=3;
xinc=1;
xmax=8;
[back_Difference, central_Difference, forward_Difference] = Derivative(anon_Function, xmin, xmax, xinc)
MatLab Help!! Write a function called Difference to calculate the central difference, forward diflerence, and backward diference approximation to an function within a given range of xmin:xinc:xmax...
5. Create a MATLAB script to find the first and second derivative of given function using Forward, Backward, central and Taylor numerical schemes. Test your code using the following functions: f(x)-xe*+3x2 +2x -1 and find f (3) and f' (3) for with h 0.1, 0.01 and 0.001 b. Approximate y'(1) and y"(1) using the following table f(x) 0.992 0.8 0.9 0.999 1.0 1.001 1.008 Input: (copy and paste the MATLAB or Scilab script in the following box) 5. Create a...
Write a function called ZeroCornersSecondRow that sets the corners of a 2D array to zero and also outputs the second row. The input arguments: • inArray: A double precision 2D array of size nxn, where n is at least 3. The output arguments: outArray: A double precision 2D array of size nxn that is a copy of inArray except with the corners set to zero. • secondRow: A double precision 1D array of size n. This is the second row...
MATLAB Only MATLAB Only MATLAB Only Indicated in the script below, write a function, called arbpoly3, that accepts two inputs: i) a row vector, called c, containing the coefficients of the polynomial, starting with the coefficient for the lowest degree term, which is the constant term. ii) a row vector, called x, which is the set of real numbers where the polynomial is to be evaluated. The output, y, will be a vector containing the values of the polynomial, evaluated...
[MATLAB] Write a function called myMultProd.m that computes the cumulative product of the elements in a vector. The cumulative product, pj, of the jth element of the vector x, xj, is defined by pj = (x1)(x2) … (xj) for j = 1:length of the vector x. DO NOT USE CUMPROD For example, when you run your function it should look like this: >> x = [2 3 4 2]; >> myMultProd(x) >> ans = 2 6 24 48 That is,...
Given a list of predicted values and a list of their corresponding observed values, complete the function FilterOutliers that computes the error of the data, removes outliers, and re-computes the error. The input arguments: • predicted: A double precision 10 array of size n containing the predicted values. . observed: A double precision 1D array of size n containing the observed values • threshold: A double precision positive scalar that determines if an observation is an outlier. The output arguments:...