Volume of Ellipsoid – MATLAB

This is how you calculate the volume of an ellipsoid with the following equation.

rmax = 1;
V = 0;
step = 0.02;
A = 5;

B = 10;
C = 15;
for x= -5 : step : 5
for y = -10 : step : 10
for z = -15 : step : 15
if((x/A).^2 + (y/B).^2 + (z/C).^2) < rmax
V = V + step.^3;
end
end
end
end
disp(V)

it should spit out , approximately

Leave a Reply

Your email address will not be published. Required fields are marked *