i have some error in my MATLAB code .
조회 수: 1 (최근 30일)
이전 댓글 표시
% EQUATION OF FLIGHT DYNAMICS IN STATE SPACE FORM
% state space matrix
A = [-0.00871, -0.019, -135, -32.12;
-0.0117, -0.311, 1931, -2.246;
0.0004761, -0.00673, -0.182, 0;
0, 0, 1, 0];
B = [6.24; -89.2; -9.80; 0];
C = [-0.127, 0.0698, -0.998, 0.01659;
-2.36, -1.02, 0.0103, 0;
11.1, -0.00735, -0.196, 0;
0, 1, 0, 0];
D = [-0.00498, 0.0426;
28.7, 5.38;
0.993, -6.90;
0, 0];
% control inputs (ELEVATOR,AILERON,RUDDER)
delta_e = @(t) [0; 0; 0; 0];
% state derivative function
state_derivative = @(t, x) A * x + B * delta_e(t);
% initial condition
initial_state = zeros(4,1);
%timespan--------------------------------------------------------------
tspan = [0, 10];
%solving equation using ode45
[t, x] = ode45(state_derivative, tspan, initial_state);
%%%ploting results------------------------------------------------------
figure;
subplot(2, 2, 1);
plot(t, x(:, 1));
xlabel('Time (s)');
ylabel('u');
title('velocity u');
subplot(2, 2, 2);
plot(t, x(:, 2));
xlabel('Time (s)');
ylabel('\omega');
title('angular velocity \omega');
subplot(2, 2, 3);
plot(t, x(:, 3));
xlabel('Time (s)');
ylabel('q');
title('pitch rate q');
subplot(2, 2, 4);
plot(t, x(:, 4));
xlabel('Time (s)');
ylabel('\theta');
title('pitch angle \theta');
댓글 수: 0
답변 (1개)
Torsten
2023년 10월 2일
B*delta_e(t)
is undefined since B and delta_e(t) are both 4x1.
Maybe you mean
B.*delta_e(t)
instead.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Model Order Reduction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!