Using Simpson's rule to get immersed volume as the lifeboat immersed into the water

4 views (last 30 days)
Hi there,
I am doing a simulation of a free-fall lifeboat trajectory into the ocean and there is a part where i need to get the volume of the lifeboat to obtain its buoyancy force.
Buoyancy force is proportional to the immersed volume of the body and this volume can be obtain by integrating the immersed cross-section area along the length of the boat(I am using Simpson's rule 1/3 for this). Buoyancy force = Density*gravity*volume
Question i would like to ask, do i need to find the volume in a time-step manner, currently the ideal i have in mind is at each meter of the lifeboat length i will obtain a cross-section and after reaching the end of the lifeboat length which is 8.5 m i add up all the cross-section area? however i do not know how to do it, i tried doing the simpson's rule. But i could only get a single number.
I hope anybody out there could help me, really need your help, thank you so much! Best Regards, Noel
%INPUTS
L = 0; %lower limit
U = 8.5; % upper limit
n = 40; % number of segments
Length = 1;
Breath = 3;
Height = 2.3;
density= 1.025;
g = 9.81;
func = @(x) (Breath * Height);
h = (U-L)/n;
st4 = 0;
st2 = 0;
for i = 2:h:n
st4 = st4 + 4*func(i);
end
for i = 3:h:n
st2 = st2 + 2*func(n);
end
Buoyancy_force = (density*g)*(h/3*(func(1)+st4+st2+func(i)));
disp (Buoyancy_force)
fprintf('step %.3f\n',i);
disp (st4)
disp (st2)
  2 Comments
John D'Errico
John D'Errico on 9 Apr 2016
Edited: John D'Errico on 9 Apr 2016
I was sure I remembered this question before. It looks like you are making progress though.
A problem with Simpson's rule is it is not so easy to make it work in a cumulative way. The coefficients are set so that if you have an odd number of points, the total integral will be accurate. But if you try to look at it in a cumulative sense, those cumulative integrals will not be so accurate.
The point is, a better solution for this problem is a cumulative trapezoidal rule. You can thus just use cumtrapz, and have MATLAB do the work. Since my guess is that cumtrapz is not allowed, it is still easy to build from scratch, and make it work nice and be fairly accurate. In fact, you may find that a cumulative trapezoidal rule is effectively as accurate as a cribbed together cumulative Simpson's rule, and FAR easier to compute.
If you wanted more accuracy, I would immediately look to a cubic spline, then integrating the spline segments in a cumulative fashion. A nice thing is then you could predict the integral at ANY point and do so with superb accuracy. I think that is beyond the scope of your project though.
Kuifeng
Kuifeng on 10 Apr 2016
Edited: Kuifeng on 10 Apr 2016
An alternative approach, try to calculate the volume instead of calculating the cumulative area. Then sum all volumes up. Actually the cross-section area is better to be calculated based on line profile using the Simpson's rule too.
delta_volume = cross_sec_Area_submerged*delta_x,

Sign in to comment.

Answers (0)

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!