MATLAB: How to solve this problem ? ‘Area between curves’

areacalculusgraphplotplotting

clear all
clc
syms x;
f=@(x) x^3-3*x^2;
g=@(x) 4*x;
IP=solve(f(x)-g(x))
A1=int(-g(x)+f(x),-1,0);
A2=int(-f(x)+g(x),0,4);
A=A1+A2
Aalt=int(abs(f(x)-g(x)),-1,4)

Best Answer

fplot(f,[-2 5])
hold on
fplot(g,[-2 5],'r')
hold off