Info

此问题已关闭。 请重新打开它进行编辑或回答。

2 second order equations ode45, that depend on a solution to one of the second order equations

1 次查看(过去 30 天)
Hello MatLab!
I am currently learning how to use MatLab for a physics research project at my university. I tried writing my own RK45 script but I am not sure if the results I got make any sense, so I want to compare my results with those of ODE45. However, I am unsure how to give ODE45 four first order equations. The equations I want to use are the following,
function vdot = quad_drag_density(t,v)
% Here we will define our constants
m = 1; % Mass of a shell, in kg
g = 9.81; % Acceleration of gravity, in m/s
r = 0.15; % Radius of shell, in m
C_d = 0.4; % Coefficient of drag such that the % drag is proportional to the square % of the speed
A = pi*r^2; % Cross sectional area of shell, in % m^2
x_ddot = (-(1.22)*exp(-y(1)/8500)*C_d*A*sqrt(vx(1)^2 + vy(1)^2) ... *vx(1))/2*m;
y_ddot = - g - ((1.22)*exp(-y(1)/8500)*C_d*A*sqrt(vx(1)^2 ... + vy(1)^2)*vy(1))/2*m;
I spilt each into two first order equations as follows,
dz(1) = z(2);
dz(2) = (-(1.22)*exp(-z(3)/8500)*C_d*A*sqrt(z(2)^2 + z(4)^2) ... *z(2))/2*m;
dz(3) = z(4);
dz(4) = - g - ((1.22)*exp(-z(3)/8500)*C_d*A*sqrt(z(2)^2 ... + z(4)^2)*z(4))/2*m;
vdot = [dz(1); dz(2); dz(3), dz(4)];
and I do not know where to go from here, or if anything I did was correct up to here.

回答(0 个)

此问题已关闭。

Community Treasure Hunt

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

Start Hunting!

Translated by