function [T] = plots_TC04b_oem_hfb(T, Z, Y, Uinp, params, par_std, iter); % Time history plots of measured and estimated responses and parameter convergence % test_case = 4 -- Longitudinal motion: HFB-320 Aircraft % Nonlinear model in terms of non-dimensional derivatives as function of % variables in the stability axes (V, alfa) % states - V, alpha, theta, q % outputs - V, alpha, theta, q, qdot, ax, az % inputs - de, thrust % parameters - CD0, CDV, CDAL, CL0, CLV, CLAL, CM0, CMV, CMAL, CMQ, CMDE % f11, f22, f33, f44 (diagonal elements of process noise matrix) % Conversion factor radians to degrees r2d = 180/pi; %Plot time histories of measured and estimated observation variables figure(1) subplot(511),plot(T,Z(:,1), T,Y(:,1),'r'); grid; ylabel('U (m/s)'); title('Time histories of output variables (measured and estimated); input variables') subplot(512),plot(T,Z(:,2)*r2d, T,Y(:,2)*r2d,'r'); grid; ylabel('\alpha (deg)'); subplot(513),plot(T,Z(:,3)*r2d, T,Y(:,3)*r2d,'r'); grid; ylabel('\theta (deg)'); subplot(514),plot(T,Z(:,4)*r2d, T,Y(:,4)*r2d,'r'); grid; ylabel('q (deg/s)'); %subplot(815),plot(T,Z(:,5)*r2d, T,Y(:,5)*r2d,'r'); grid; ylabel('qp (deg/s2)'); %subplot(816),plot(T,Z(:,6), T,Y(:,6),'r'); grid; ylabel('ax (m/s2)'); %subplot(817),plot(T,Z(:,7), T,Y(:,7),'r'); grid; ylabel('az (m/s2)'); subplot(515),plot(T,Uinp(:,1)*r2d); grid; ylabel('{\delta_e} (deg)'); xlabel('Time in sec'); % •Û‘¶ if 0 csvwrite('history.csv', [T Z(:,1) Y(:,1) Z(:,2)*r2d Y(:,2)*r2d Z(:,3)*r2d Y(:,3)*r2d Z(:,4)*r2d Y(:,4)*r2d Uinp(:,1)]); end % Convergence plot: estimated parameter +- standard deviations versus iteration count if iter > 0, iterations = [0:iter]; figure(2); zoom; subplot(4,3, 1);errorbar(iterations, params(1,:),par_std(1,:));ylabel('Xu'); xlabel('iteration #');grid title('Convergence of parameter estimates with error bounds') subplot(4,3, 4);errorbar(iterations, params(2,:),par_std(2,:));ylabel('X{\alpha}'); xlabel('iteration #');grid subplot(4,3, 2);errorbar(iterations, params(3,:),par_std(3,:));ylabel('Zu'); xlabel('iteration #');grid subplot(4,3, 5);errorbar(iterations, params(4,:),par_std(4,:));ylabel('Z{\alpha}'); xlabel('iteration #');grid subplot(4,3, 8);errorbar(iterations, params(5,:),par_std(5,:));ylabel('Zq'); xlabel('iteration #');grid subplot(4,3,11);errorbar(iterations, params(6,:),par_std(6,:));ylabel('Z{\delta}e'); xlabel('iteration #');grid subplot(4,3, 3);errorbar(iterations, params( 7,:),par_std( 7,:));ylabel('Mu'); xlabel('iteration #');grid subplot(4,3, 6);errorbar(iterations, params( 8,:),par_std( 8,:));ylabel('M{\alpha}'); xlabel('iteration #');grid subplot(4,3, 9);errorbar(iterations, params( 9,:),par_std( 9,:));ylabel('Mq'); xlabel('iteration #');grid subplot(4,3,12);errorbar(iterations, params(10,:),par_std(10,:));ylabel('M{\delta}e'); xlabel('iteration #');grid end