I need help to configure how to use atmosisa function if we need to use height function h(t) as input? In this ODE45, I set variable z to be z(1), z(2), z(3) and z(4). z(2) is the height variable. When I put height to be 1000m, the code does work but when I put in as z(2) as input, it gives error.
Density.m
function rho=density()
[~, ~, ~, rho]=atmosisa(z(2));
end
rhs_trajectory
function dz = rhs_trajectory(z,g,F,F_d,m,gamma)
x = z(1);
y = z(2);
v_x = z(3);
v_y = z(4);
dx = v_x;
dy = v_y;
dv_x = ((F-F_d)/m)*cos(gamma)-m*sin(gamma);
dv_y = ((F-F_d)/m)*sin(gamma)-g;
dz = [dx; dy; dv_x; dv_y];
end
I attached other necessery function for reference. Please help me.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.