Hello,
I am trying to calculate the area of the shaded area shown in the graph. This is my Matlab code. When I use trapz keyword it gives me the whole area. Is there any way to calculate the shaded area 1 and area 2 which are separated by the dotted lines.
clear allclcclose allx=0:0.1:3.14;y=sin(4*x).*sec(3*x);yy = zeros(1,length(x));yy(:) = 0;y1=-20:0.1:20;x1 = ones(1,length(y1));x1(:) = 0.5;plot(x,y,x,yy,'--',x1,y1,'--')trapx(x,y)
Is there also any way to select area 1 and paint it with different colors using matlab code.
Thanks
Best Answer