I have coded the equations of motion in Matlab, and I am using the ode45 function to simulate the nonlinear dynamics of F/A-18 Hornet without any controller (just the airframe). I have given initial conditions as trim conditions.
d2r = pi/180; % degree to rad V = 438.653328; % Airspeed , ft/s beta = 0*d2r; % Sideslip Angle, rad alpha = 10*d2r; % Angle-of-attack, rad p = 0*d2r; % Roll rate, rad/s q = 0*d2r; % Pitch rate, rad/s r = 0*d2r; % Yaw rate, rad/s phi = 0*d2r; % Roll Angle, rad theta = 10*d2r; % Pitch Angle, rad psi = 0*d2r; % Yaw Angle, rad pN = 0; % X position in Earth Frame, ft pE = 0; % Y position in Earth Frame, ft h = -25000; % Z position in Earth Frame, ft
During the first iteration, C_m has a very positive small value (1e-10), which leads to some pitching moment when multiplied by S, c, and qbar (even though it's small). But, as time keeps on increasing, this value of C_m goes on increasing and as a result, a large moment is created. Due to the high precision of Matlab, the pitching moment coefficient is not for the given trim condition.
My question is: should I round off the values of C_m to 3 or 4 digits? By rounding off, the C_m will be zero and I get M as zero.
The below figure shows how velocity is varying with time when the aforementioned initial conditions are given.
This figure is obtained after rounding off C_m to 4 significant digits.