Answered You can hire a professional tutor to get the answer.

QUESTION

1 ) compute the numerical derivative of f ( x ) = ace * for xi 10 0 1 . 10 by using the following formula with h = 0.

This problem is from using MatLab. I want the code step by step.

[Codes below might be useful to solve this problem.]

fun=@(x) exp(exp(sin(x^2)))

%function handle

df_analytical=@(x) exp(exp(sin(x^2)))*exp(sin(x^2))*cos(x^2)*(2*x)

%analytical derivative

a=1;

h=0.1;

df=Numerical_derivative(fun,a,h);

%compute the derivative

err1=df-df_analytical(a)

%numerical test order

h=0.05;

df=Numerical_derivative(fun,a,h);

err2=df-df_analytical(a)

log2(err1/err2)

h=0.025;

df=Numerical_derivative(fun,a,h);

err4=df-df_analytical(a)

log2(err2/err4)

function df=Numerical_derivative(fun,x,h)

df=(fun(x+h)-fun(x))/h;%forward scheme

df=(fun(x+h)-fun(x))/h;%backward scheme

df=(fun(x+h)-fun(x-h))/2/h;%central finite difference 

1 ) compute the numerical derivative of f ( x ) = ace * for xi100 1 .. . 10 by using the following formula with h = 0.01( a ) = Azh If ( a - 2 1 ) - of ( a - 1 1 ) + of ( a + h ) - f ( a + 2 1 )( # 12 ) compare the difference between numerical and real derivatives foreach xi3 ) Test the accuracy order for the formula ( * ) numerically
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question