修改俯仰和滚转通道打靶脚本

This commit is contained in:
LZY\79495
2025-06-12 14:15:11 +08:00
parent aa84becd23
commit 7008f1ff2e
2 changed files with 23 additions and 177 deletions
+13 -97
View File
@@ -1,28 +1,14 @@
function LHS_PITCH_SHOOTS()
close all
% H_lst1 = [1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000];
% CAS_lst1 = [35 40 45 50 55 35 40 45 50 55 60 35 40 45 50 55 60];
% mass_lst1 = [260 260 260 260 260 350 350 350 350 350 350 450 450 450 450 450 450];
%
% H_lst2 = [2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000];
% CAS_lst2 = [35 40 45 50 55 35 40 45 50 55 60 35 40 45 50 55 60];
% mass_lst2 = [260 260 260 260 260 350 350 350 350 350 350 450 450 450 450 450 450];
%
% H_lst3 = [4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000];
% CAS_lst3 = [35 40 45 50 55 35 40 45 50 55 60 35 40 45 50 55 60];
% mass_lst3 = [260 260 260 260 260 350 350 350 350 350 350 450 450 450 450 450 450];
%
% H_lst4 = [6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000];
% CAS_lst4 = [35 40 45 50 55 35 40 45 50 55 60 35 40 45 50 55 60];
% mass_lst4 = [260 260 260 260 260 350 350 350 350 350 350 450 450 450 450 450 450];
H_lst = [1000 1000 1000 1000 1000 1000];
CAS_lst = [35 40 45 35 40 45];
mass_lst = [305 305 305 350 350 350];
H_lst = [500];
CAS_lst = [35];
mass_lst = [350];
% H_lst = [1000];
% CAS_lst = [40];
% mass_lst = [305];
%%
RMS.tht(1,1) = 0;
@@ -34,77 +20,7 @@ for kk = 1:length(H_lst)
RMS = csas_mp_shoots(H_lst(kk),CAS_lst(kk),mass_lst(kk),kk,RMS);
end
% proj = slproject.getCurrentProject;
% cd([proj.RootFolder '/work']);
% save RMS_MC_PITCH.mat RMS
% %%
% figure(1)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.phi,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Roll angle tracking RMS error [deg]')
% % box_vars = findall(gca,'Tag','Box')
% % hlegend = legend(box_vars([23,1]), {'before compenstation','after compenstation'},'Location','best')
%
% figure(2)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.tht,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Pitch angle tracking RMS error [deg]')
%
% figure(3)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.ay,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Lateral acceleration RMS error [deg]')
%
% figure(4)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.p,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Roll rate tracking RMS error [deg/s]')
%
% figure(5)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.q,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Pitch rate tracking RMS error [deg/s]')
%
% figure(6)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.r,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Yaw rate tracking RMS error [deg/s]')
%
% %%
% h{1,1} = 'RMS';
% h{1,2} = figure(1);
% h{2,1} = 'RMS';
% h{2,2} = figure(2);
% h{3,1} = 'RMS';
% h{3,2} = figure(3);
% h{4,1} = 'RMS';
% h{4,2} = figure(4);
% h{5,1} = 'RMS';
% h{5,2} = figure(5);
% h{6,1} = 'RMS';
% h{6,2} = figure(6);
%
% cd([proj.RootFolder '/docs/PITCH SHOOT']);
% labl = ['Tracking_error_RMS_pitch'];
%
% if exist(labl,'dir') == 0
% mkdir(labl);
% else
% rmdir(labl,'s');
% mkdir(labl);
% end
%
% eval(['cd ' ,'''',labl,'''']);
%
% for idx = 1:size(h)
% savefig(h{idx,2},h{idx,1});
% end
close all
%% initialize report
@@ -119,7 +35,7 @@ fcn = 'sunny360vfe_sim_csas';
tp = TitlePage;
tp.Title = 'Latin hypercube sampling Shoots';
tp.Subtitle = ['for model ' fcn];
tp.Author = 'Lyu Weiye';
tp.Author = 'Liu Zhengyang';
add(rpt,tp);
folds=dir(pwd);
@@ -193,9 +109,9 @@ in.signals(1).values = zeros(slen,1,'single'); % phi_c
in.signals(2).values = zeros(slen,1,'single'); % hdot_c
in.signals(3).values = ones(slen,1,'single')*CAS; % v_c
in.signals(4).values = zeros(slen,1,'single'); % ay_c
in.signals(5).values = single([0 0 0.1 0.1 0 0 0]')+tht0; % tht_c
in.signals(5).values = single([0 0 10/57.3 10/57.3 0 0 0]')+tht0; % tht_c
n = 100;
n = 2;
out = cell(n,1);
rtp1 = rsimsetrtpparam(rtp, ...
@@ -280,9 +196,9 @@ for idx = 2:n
% para.wn_act(idx-1) = 43; %ceil((rand()-0.5)*2*20 + 56); % act bandwidth (40~60 rad/s)
cg_x = para.cg_xUncertGain(idx-1)*0.655*0;
cg_y = para.cg_yUncertGain(idx-1)*0.655*0;
cg_z = para.cg_zUncertGain(idx-1)*0.655*0;
cg_x = para.cg_xUncertGain(idx-1)*0.655;
cg_y = para.cg_yUncertGain(idx-1)*0.655;
cg_z = para.cg_zUncertGain(idx-1)*0.655;
rtp1 = rsimsetrtpparam(rtp, ....
'X0', X0, ... % 'IASUncertGain',1.0+(rand()-0.5)*2*0.15,...
+10 -80
View File
@@ -2,26 +2,10 @@ function LHS_ROLL_SHOOTS()
close all
%% mission profile
H_lst1 = [500];
CAS_lst1 = [35];
mass_lst1 = [350];
%
% H_lst2 = [2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000];
% CAS_lst2 = [35 40 45 50 55 35 40 45 50 55 60 35 40 45 50 55 60];
% mass_lst2 = [260 260 260 260 260 350 350 350 350 350 350 450 450 450 450 450 450];
%
% H_lst3 = [4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000];
% CAS_lst3 = [35 40 45 50 55 35 40 45 50 55 60 35 40 45 50 55 60];
% mass_lst3 = [260 260 260 260 260 350 350 350 350 350 350 450 450 450 450 450 450];
%
% H_lst4 = [6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000 6000];
% CAS_lst4 = [35 40 45 50 55 35 40 45 50 55 60 35 40 45 50 55 60];
% mass_lst4 = [260 260 260 260 260 350 350 350 350 350 350 450 450 450 450 450 450];
H_lst = H_lst1; %[2000 2000 2000];
CAS_lst = CAS_lst1; %[27 30 35 ];
mass_lst = mass_lst1; %[380 380 380 ];
H_lst = [1000 1000 1000 1000 1000 1000];
CAS_lst = [35 40 45 35 40 45];
mass_lst = [305 305 305 350 350 350];
df_lst = 0;
@@ -35,61 +19,7 @@ for kk = 1:length(H_lst)
RMS = csas_mp_shoots(H_lst(kk),CAS_lst(kk),mass_lst(kk),kk,RMS,df_lst);
end
% proj = slproject.getCurrentProject;
% cd([proj.RootFolder '/work']);
% save RMS_MC_ROLL.mat RMS
% %%
% figure(1)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.phi,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Roll angle tracking RMS error [deg]')
% % box_vars = findall(gca,'Tag','Box')
% % hlegend = legend(box_vars([23,1]), {'before compenstation','after compenstation'},'Location','best')
%
% figure(2)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.p,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Roll rate tracking RMS error [deg/s]')
%
% figure(3)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.r,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Yaw rate tracking RMS error [deg/s]')
%
% figure(4)
% set(gcf,'Position',[0 0 700 600],'Color',[1 1 1],'Renderer','painters');
% boxplot(RMS.ay,Ma_lst,'color','k','Symbol','kx')
% xlabel('Ma')
% title('Lateral acceleration tracking RMS error [m/s^2]')
% %%
% h{1,1} = 'RMS';
% h{1,2} = figure(1);
% h{2,1} = 'RMS';
% h{2,2} = figure(2);
% h{3,1} = 'RMS';
% h{3,2} = figure(3);
% h{4,1} = 'RMS';
% h{4,2} = figure(4);
%
% proj = slproject.getCurrentProject;
% cd([proj.RootFolder '/docs/ROLL SHOOT']);
% labl = ['Tracking_error_RMS_roll'];
%
% if exist(labl,'dir') == 0
% mkdir(labl);
% else
% rmdir(labl,'s');
% mkdir(labl);
% end
%
% eval(['cd ' ,'''',labl,'''']);
%
% for idx = 1:size(h)
% savefig(h{idx,2},h{idx,1});
% end
close all
%% initialize report
@@ -100,11 +30,11 @@ cd([proj.RootFolder '/docs/ROLL SHOOT']);
rpt_name = 'LHS Monte Carlo simulation';
[~,~,~] = fileparts(pwd);
rpt = Report(rpt_name,'docx');
fcn = 'sunny450_sim_csas';
fcn = 'sunny360vfe_sim_csas';
tp = TitlePage;
tp.Title = 'Latin hypercube sampling Shoots';
tp.Subtitle = ['for model ' fcn];
tp.Author = 'Lyu Weiye';
tp.Author = 'Liu Zhengyang';
add(rpt,tp);
folds=dir(pwd);
@@ -145,9 +75,9 @@ proj = slproject.getCurrentProject;
wd = cd;
cd([proj.RootFolder '/work']);
Ixx = 270;
Iyy = 240;
Izz = 470;
Ixx = 521.24;
Iyy = 200.726;
Izz = 713.778;
Ixy = 0;
Ixz = 30;
Iyz = 0;
@@ -180,7 +110,7 @@ in.signals(4).values = single([0 0 0 0 0 0 0
in.signals(5).values = zeros(slen,1,'single')+tht0; % tht_c
n = 50;
n = 100;
out = cell(n,1);
rtp1 = rsimsetrtpparam(rtp, ...