Create a script file that calls a userdefined function withi

Create a script file that calls a user-defined function within a for/end loop to symbolically compute the derivative of the natural log of x, or In(x), on the interval from -5 to 5, containing 100 data points. The output of the script file should be a line with symbols, a grid and appropriate labels. The user-defined function should Receive the particular x value in the loop. Symbolically take the derivative of the mathematical function log(x). Substitute the particular x value into the derivative. Return the computed derivative back to the script file to be stored in a vector.

Solution

// save the below code as DerivativeOfLog.m

clc
clear all
close all
function f=DerivativeOfLog(x)
syms x
G=log10(x);
f=diff(G);
end

// run the below code after saving of above

for x=-5 : 0.1 : 5

f(x)=DerivativeOfLog(x);

end

 Create a script file that calls a user-defined function within a for/end loop to symbolically compute the derivative of the natural log of x, or In(x), on the

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site