On the interval I51065106 we define the function fxln1xcosxx
On the interval I=[-5*10^-6,5*10^-6] we define the function f(x)=ln(1+x)-cosx-x+1
Plot this function in Matlab by evaluating it at 1001 equally distributed points in the interval I and perform all calculations in IEEE standard double precision.Explain the plot you obatined.
And reformulate the function f(x) to obtain a more accurate result and then repeat the first question.
Solution
%defining range
x = [-5*10^-6:0.1:5*10^-6]
y = log(1+x)-cos(x)-x+1
figure
plot(x,y)
![On the interval I=[-5*10^-6,5*10^-6] we define the function f(x)=ln(1+x)-cosx-x+1 Plot this function in Matlab by evaluating it at 1001 equally distributed poin On the interval I=[-5*10^-6,5*10^-6] we define the function f(x)=ln(1+x)-cosx-x+1 Plot this function in Matlab by evaluating it at 1001 equally distributed poin](/WebImages/34/on-the-interval-i51065106-we-define-the-function-fxln1xcosxx-1102065-1761582510-0.webp)