Project Set 2

Matlab coding of topics from CO2 to CO4 Set 2

MATH147
2Q1819
Course Outcome 2
  • Integration of exponential function
  • syms x
    int(1/(5+2*exp(x)))

  • Integration by trigonometric transformation
  • syms x
    int((csc(x)^8)*(cot(x)^2))

  • Integration by trigonometric substitution
  • syms x
    int((exp(x))*(sqrt(9-exp(2*x))))



    Course Outcome 3
  • Definite Integral
  • syms x
    int(((x^2 + 2*x + 3)/(x^3+3*x^2+3*x)),1, 5)

  • Definite integrals of absolute value functions
  • syms x
    int(abs(x^2 + 6*x + 8),-8,4)
    
    f(x)=abs(x^2 + 6*x + 8);
    fplot(abs(x^2 + 6*x + 8),[-10,6])
    daspect([1 8 1]);
    grid on
    %line([-1,-1],[0,0]);
    line([7,7],[-5,0]);

  • Area of a plane region
  • syms x
    int((3-sqrt(x)),0,9)
    
    y = @(x) (3-sqrt(x));
    x = linspace(0, 9);
    inty = cumtrapz(x,y(x));
    figure(1)
    plot(x, inty, '-k', 'LineWidth',1)
    hold on
    patch([x fliplr(x)], [zeros(size(x)) fliplr(inty)], 'g')
    hold off
    grid



    Course Outcome 4
  • Double Integrals
  • syms x y
    int(int(sqrt(x+y),x,0,3*y),y,0,1)

  • Triple integrals
  • syms x y z
    int(int(int(x*y*z,z,1,y),y,-1,x^2),x,0,2)

  • Double integrals over nonrectangular regions
  • syms x y
    int(int(x,y,exp(x),exp(2)),x,0,2)
    
    round(int(int(x,y,exp(x),exp(2)),x,0,2)) %Rounded answer
    
    clear all, close all; clc
    x = 0 : 2;
    curve1 = exp(x);
    curve2 = exp(2)+0*x;
    plot(x, curve2, 'b', 'LineWidth', 1);
    hold on;
    plot(x, curve1, 'b', 'LineWidth', 1);
    x2 = [x, fliplr(x)];
    inBetween = [curve1, fliplr(curve2)];
    fill(x2, inBetween, 'g');
    grid