How to add trim values on to a linear models output?

2 visualizaciones (últimos 30 días)
Daniel Jackson
Daniel Jackson el 21 de Mzo. de 2024
Respondida: Nipun el 11 de Jun. de 2024
I am comparing a nonlinear model to a linear model, a short elevator input over 10s is used for the input for both the linear and non linear models. And as linear models are defined by deltas around an operating point I was wondering how I would go about adding trim values to the linear model output.
%% Set aircraft parameters
m = 18000;
S = 64.8;
rho = 0.905;
g = 9.81;
a1 = 4.33;
a2 = 2.16;
a3 = 0.47;
b1 = -0.11;
b2 = -0.64;
DWG = 0.4;
S_T = 10.7;
l_T = 11;
c = 2.51;
h_fwd = 0.18; % 0.1 - 0.3
h_aft = 0.66; % 0.6 - 0.7
psi_T = -5.5 * pi / 180;
I_yy = 136182.4308;
I_xx = 236000;
I_zz = 355000;
I_xz = 0;
% Set Aero parameters
a = 5.3;
h_AC = 0.27;
C_L_Max = 1.2;
C_M_0 = -0.06;
% Set CG
h = h_fwd;
% Calculate intermediate groups
V_T = S_T * l_T / (S * c);
d_T = l_T - (h-h_AC)*c;
h_n = h_AC + V_T * (a1/a)*(1-DWG);
% Calculate speed parameters
V_Stall = sqrt(2*m*g/(rho * S * C_L_Max)) * 1.94;
V_Max = 336;
V_C = 268.8;
V_1 = 210;
V_2 = 315;
C_L_Cruise = 2 * m * g / ((V_C/1.94)^2 * S * rho);
C_L_VMax = 2 * m * g / ((V_Max/1.94)^2 * S * rho);
% Set Speed
V = V_C/1.94;
% Drag parameters
C_D_0 = 0.011;
k = 0.041263048;
% Set thrust derivative
dEpsdT = 300;
%% Run 3DoF model
eta_step = -5;
eta_step_t = 0.5;
A = [-0.00787490219865814,0.0914386059970311,-8.15800578286344,-9.80848204812432;
-0.0705390429309272,-1.20661074126797,138.553434891686,0.172568561106160;
0.0103919494442555,-0.176494149311203,-2.63846804739098,0;
0,0,1,0];
B = [0.016666666666667,0;0,0;0,-16.272914167767752;0,0];
C = [1,0,0,0;
0,1,0,0;
0,0,1,0;
0,0,0,1;
0.998271075633783,0.0587780534943110,0,0;
0.000423493150696744,-0.00719249682384279,0,1];
D_0 = [0,0;0,0;0,0;0,0;0,0;0,0];
The linear model has been constructed by trimming the non linear model and using its matrix outputs. Attached is the simulink model and MATLAB code.

Respuestas (1)

Nipun
Nipun el 11 de Jun. de 2024
Hi Daniel,
I understand that you are trying to compare a nonlinear model to a linear model and need to add trim values to the linear model output. Here is how you may do it:
% Define the trim values (assumed example values, update as needed)
trim_values = [trim_x1, trim_x2, trim_x3, trim_x4]; % Replace with actual trim values
% Set up your linear model response
linear_response = lsim(A, B, C, D_0, input_signal, t);
% Add trim values to the linear model output
linear_response_trimmed = linear_response + trim_values;
% Plot to compare
figure;
plot(t, nonlinear_response, 'r', t, linear_response_trimmed, 'b');
legend('Nonlinear Model', 'Linear Model with Trim');
xlabel('Time (s)');
ylabel('Response');
title('Comparison of Nonlinear and Linear Models');
Refer to the following MathWorks documentation for more information for plotting dynamic system reponse: https://www.mathworks.com/help/control/ref/lsim.html
Hope this helps.
Regards,
Nipun

Categorías

Más información sobre General Applications en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by