simple simulation of a tethered floater going up and down
6 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a question about a simple system I am simulating, it is about a floating sphere attached to a tether (F_T) which experiences drag by the water (F_D). I use the ode45 to simulate the displacement and velocity, however I cannot figure out how to fix the function so that with initial conditions [-1000 0] (starts at seabed) the system goes up( for that F_T= 2150000) until -50m where the F_T changes to 2200000. Also the F_D must change direction when the velocity( x(2)) changes direction. The displacement is x(1). I tried using if and else statements however I cannot seem to make it work. If possible the system should also go up again when it reaches -1000m when going down. I use ode45 in my main file for this function.
I hope someone can help me out!
Thanks in advance!
function dxdt = odefun_upward_motion(t,x)
%parameters
g = 9.81 ;
Cd = 0.18 ;
rho_f = 997 ;
r_out = 5.1 ;%m
A = pi*r_out^2;
V_s = 1000;
m = 775000;
F_b = rho_f*g*V_s;
F_z = m*g;
K = F_b - F_z; %constant K
% F_d_charge = rho_f*Cd*A*x(2)*(x(2));
% F_d_discharge = -rho_f*Cd*A*x(2)*x(2);
F_T = 2150000;
F_D = -rho_f*Cd*A*x(2)*x(2);
if (x(1)>=-50)
F_T = 2200000;
F_D = rho_f*Cd*A*x(2)*x(2);
end
dxdt = [x(2); ((K + F_D - F_T)/m)];
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!