# project2.m - clc*1 The code written below states all of the...

• 2
• 100% (4) 4 out of 4 people found this document helpful

This preview shows page 1 - 2 out of 2 pages.

clc % *1.* % The code written below states all of the symbolic variables needed % throughout the document. syms x t f(t) f(x) %% % *2.* % Using the _diff_ command, the following code takes various derivatives of % the equations. p2a = diff(2^x + ((x+2)/(2*x-5))) p2b = diff(x*log(2-3*x), 2) p2c = diff((cos(x) + atan(x))^(1/3)) p2d = subs(diff((t^2)/(4*t-2)), t, -1) %% % *3.* % Using the _int_ command, the code below is taking the integral of the % equations. p3a = int((x^2)*cos(1-x)) p3b = int(x*exp(2*x+1), -0.1, 0.2) %% % *4.* % Using the _dsolve_ command, the code below is solving the differential % below. p4 = dsolve('Dy = -(y/t) + 3 - sin(t)') %% % *5.* % Given the initial value problem below, I used the following commands in % order to make the calculation % # One - subs, this subsitutes the variable into the equation % # two - dsolve, this solves the equation prior to inputing the variable p5 = subs(dsolve('Df(r)=(-2)*sin(r)+f(r)','f(pi)=0','r'),{'r'},{0}) %% % *6.* % Starting with a symbolically defined function f(x), the following code % performs numerous calculations. f(x) = 3*x + (1/x) p6b = f(1.3) p6c = subs(diff(f(x),2), x, -5.3)