MATLAB: Performing a Double Integration

integralintegral2MATLAB and Simulink Student Suite

I'm trying to find the area of a deformed circle using the following code:
% Perimeter Area of the Circle
Beta = 0.2
fun3 = @(x,y) (sqrt( (((1 + 6*Beta)*cos(x) - 6*Beta*sin(x) + 3*Beta*cos(2*x))^2) + (((1+2*Beta)*sin(x) - 2*Beta*cos(x) - Beta*cos(2*x))^2)));
xmin = 0;
xmax = 2*pi;
ymin = 0;
ymax = 1;
Perimeter_Area_of_Circle = integral2(fun3,xmin,xmax,ymin,ymax)
I keep getting several erros when I try to execute this and I can't figure out what I'm doing wrong.
Thanks!

Best Answer

Hi,
Here is the corrected code of yours:
Beta = 0.2;
fun3 = @(x,y) (sqrt( (((1 + 6*Beta)*cos(x) - 6*Beta*sin(x) + 3*Beta*cos(2*x)).^2) + (((1+2*Beta)*sin(x) - 2*Beta*cos(x) - Beta*cos(2*x)).^2)));
xmin = 0;
xmax = 2*pi;
ymin = 0;
ymax = 1;
Perimeter_Area_of_Circle = integral2(fun3,xmin,xmax,ymin,ymax)
Good luck.