![Matlab code for finding integral clear all close all &Question a. syms x fprintf(a. Integration of f(x)-cosh (x) is fl (x)-c](//img.homeworklib.com/images/0774e339-07d8-4815-b9c4-90a2ec5b1dcb.png?x-oss-process=image/resize,w_560)
![For this function analytic integration is not possible Integration of t. 2.*sin(t) for limit /-10 101 is -0.000000. As it is](//img.homeworklib.com/images/23028e7b-65a7-4171-9e8b-54f7b2d49047.png?x-oss-process=image/resize,w_560)
%%Matlab code for finding integral
clear all
close all
%Question a.
syms x
fprintf('a. Integration of f(x)=cosh(x) is ')
f1(x)=cosh(x);
zz=int(f1(x));
disp(zz)
%Question b.
f2(x)=x^2*exp(-6*x);
zz=int(f2(x));
fprintf('a. Integration of f(x)=x^2*exp(-6*x) is \n')
pretty(zz)
%Question c.
f3(x)=sqrt(log(x^2-1));
zz=int(f3(x));
fprintf('c. Integration of f(x)=sqrt(log(x^2-1)) is \n')
disp(zz)
fprintf('For this function analytic integration is not
possible.\n')
%Question d.
fun = @(t) t.^2.*sin(t);
val=integral(fun,-10,10);
fprintf('\nIntegration of t.^2.*sin(t) for limit [-10 10] is
%f.\n',val)
%plotting the function
tt=linspace(-10,10);
vv=fun(tt);
plot(tt,vv,'linewidth',2)
xlabel('t')
ylabel('f(t)')
title('t vs. f(t) plot')
fprintf('As it is odd function the integral value is 0.\n')
%%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%%
Matlab code for finding integral clear all close all &Question a. syms x fprintf('a. Integration of f(x)-cosh (x) is fl (x)-cosh (x) zz-int(f1 () disp (zz) Question b. £2 (x)-x^2+exp(-6*x) ; zz-int(f2 (x)); fprintf(a. Integration of f (x)x 2*exp(-6*x) is \n') pretty (22) %Question c. f3 (x) sqrt (log (x*2-1) zz=int ( f 3 ( x)); fprintf(c. Integration of f () sgrt (log (x 2-1) is \n) disp(zz) fprintf ( For this function analytic integration is not possible.In eQuestion d fun = @(t) t."2.*sin(t); val-integral (fun,-10,10)i fprint f ( \nIntegration of In',val) t."2.*sin (t) for limit [-10 10] is %f plotting the function tt-linspace (-10,10); vv=fun (tt): plot (tt, vv, 'linewidth',2) xlabel('t') ylabel('f(t)' title( 't vs. f (t) plot' fprintf( 'As it is odd function the integral value is o.1n') 용号号응용号号응용号号응용号号응용号号 End of Code 욤융응용욤융융욤욤융융욤욤융융욤욤융 a. Integration of f(x)-cosh(x) is sinh(x) a. Integration of f(x)-x*2 exp (-6*x) is exp -6 x) (36 x + 12 x + 2) 216 c. Integration of f(x)-sqrt (log(x*2-1)) is int (log(x*2 - 1) *(1/2), x)
For this function analytic integration is not possible Integration of t. "2.*sin(t) for limit /-10 101 is -0.000000. As it is odd function the integra value is o. t vs. D plot 80 60 40 20 -20 60 10 8 -2 468 10 Published with MATLABR R2018a