Question: Develop a Matlab code that computes the concentration gradient of du/dx the user-defined profile function u(x) at a given point x0. The file should take

 Develop a Matlab code that computes the concentration gradient of du/dx

Develop a Matlab code that computes the concentration gradient of du/dx the user-defined profile function u(x) at a given point x0. The file should take as an input a function u, point x0, initial step-size h (optional argument, default value abs(x0)/10 if abs(x0) > 0 or 0.1 otherwise), desired accuracy ea (optional, default value 0.0001) and return a value of du/dx evaluated at x0 computed with the following algorithm: Center-divided difference with h is used to estimate the derivative in the first step Replace h by h/2, recomputed the derivative, calculate approximate relative error, if the absolute value of the error is below ea, then stop; otherwise continue until the specified tolerance is reached or maximal number of iterations (50) is performed. Develop a Matlab code that computes the concentration gradient of du/dx the user-defined profile function u(x) at a given point x0. The file should take as an input a function u, point x0, initial step-size h (optional argument, default value abs(x0)/10 if abs(x0) > 0 or 0.1 otherwise), desired accuracy ea (optional, default value 0.0001) and return a value of du/dx evaluated at x0 computed with the following algorithm: Center-divided difference with h is used to estimate the derivative in the first step Replace h by h/2, recomputed the derivative, calculate approximate relative error, if the absolute value of the error is below ea, then stop; otherwise continue until the specified tolerance is reached or maximal number of iterations (50) is performed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!