Azzera filtri
Azzera filtri

How to use ODE45 with two second order linear equation?

2 visualizzazioni (ultimi 30 giorni)
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.

Risposte (0)

Categorie

Scopri di più su Numerical Integration and Differential Equations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by