exp3a.docx - Department of Mathematics School of Advanced...

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

Department of Mathematics School of Advanced Sciences MAT 1011 – Calculus for Engineers (MATLAB) Experiment 3–A Applications of Integrals: finding area, volume of solid of revolution Example 1. The area bounded by the curves y 2 x 2 and the line y x , from x 1 to 2 is given by the following code: clear all clc syms x f=input('Enter the upper curve f(x): '); g=input('Enter the lower curve g(y): '); L=input('Enter the limits of integration for x [a,b]:'); a=L(1); b=L(2); Area=int(f-g,x,a,b); disp(['Area bounded by the curves f(x) and g(x) is:',char(Area)]); x1=linspace(a,b,20);y1=subs(f,x,x1); x2=x1;y2=subs(g,x,x1); plot(x1,y1);hold on; plot(x2,y2);hold off; xlabel('x-axis');ylabel('y-axis'); legend('f(x)','g(x)');grid on; Input: Enter the upper curve f(x): 2-x^2 Enter the lower curve g(x): -x Enter the limits of integration for x [a,b]:[-1,2] Output: Area bounded by the curves f(x) and g(x) is: 9/2

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture