MATLAB (2).pdf - 1 Aim Verify Lagrangeu2019s mean value...

This preview shows page 1 - 3 out of 4 pages.

1) Aim: - Verify Lagrange’s mean value theorem for the function x+e^3x in the interval [0,1]. Plot the curve along with the secant joining the end points and the tangents at points which satisfy Lagrange’s mean value theorem. Program: - clc clear syms x f(x)=x+exp(3*x); I=[0,1]; a=I(1); b=I(2); df=diff(f,x); m=(f(b)-f(a))/(b-a); c=solve(df==m,x); c=c(a<=c&c<=b); disp('the values of c lying in the interval I are'); disp(double(c)); T=f(c)+m*(x-c); disp('tangent lines of f at c are') fplot(f,I,'r'); hold on fplot(T,I,'b'); plot(c,double(f(c)),'md'); plot(I,double(f(I)),'k'); xlabel('x'); xlabel('y'); title('verification of LMVT') Output:- the values of c lying in the interval I are 0.6168 tangent lines of f at c are Graph:-
2) Aim: - Verify Rolle’s theorem for the function(x+2)^3*(x -3)^4 in the interval [-2,3]. Plot the curve along with the secant joining the end points and the tangents at points which satisfy Rolle’s Theorem. Program: - clc clear syms x f(x)=(x+2)^3*(x-3)^4; I=[-2,3]; a=I(1); b=I(2); df=diff(f,x); m=0; c=solve(df==m,x); c=c(a<=c&c<=b); disp('the values of c lying in the interval I are'); disp(double(c));

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture