109 lines
2.5 KiB
Matlab
109 lines
2.5 KiB
Matlab
|
% subplot<6F><74><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>subplot
|
|||
|
function ch_plot_imu(varargin)
|
|||
|
%% plot imu data
|
|||
|
i = 1;
|
|||
|
param= inputParser;
|
|||
|
param.addOptional('time', []);
|
|||
|
param.addOptional('acc', []);
|
|||
|
param.addOptional('gyr', []);
|
|||
|
param.addOptional('mag', []);
|
|||
|
param.addOptional('eul', []);
|
|||
|
param.addOptional('gb', []); % <20><><EFBFBD>ٶ<EFBFBD><D9B6><EFBFBD>ƫ
|
|||
|
param.addOptional('wb', []); % <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ
|
|||
|
param.addOptional('phi', []); %ʧ<CAA7><D7BC>
|
|||
|
param.addOptional('P_phi', []); %ʧ<CAA7>Ƿ<EFBFBD><C7B7><EFBFBD>
|
|||
|
param.addOptional('P_wb', []); %<25><><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD>
|
|||
|
param.addOptional('P_pos', []); %λ<>÷<EFBFBD><C3B7><EFBFBD>
|
|||
|
param.addOptional('title', []);
|
|||
|
param.addOptional('legend', []);
|
|||
|
|
|||
|
|
|||
|
%Ȼ<><C8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD>ͬ<EFBFBD><CDAC>Ĭ<EFBFBD><C4AC>ֵ<EFBFBD><D6B5><EFBFBD>Ǿ<C7BE><CDB8>ǵ<EFBFBD>
|
|||
|
param.parse(varargin{:});
|
|||
|
r = param.Results;
|
|||
|
|
|||
|
if(r.time == 0 )
|
|||
|
error('no time data');
|
|||
|
end
|
|||
|
i = 1;
|
|||
|
|
|||
|
figure;
|
|||
|
|
|||
|
if(~isempty(r.gyr))
|
|||
|
subplot(2,2,i);
|
|||
|
i = i+1;
|
|||
|
interial_display(r.time, r.gyr, {'X', 'Y', 'Z'}, 'Time (s)', 'Angular rate)', 'Gyroscope');
|
|||
|
end
|
|||
|
|
|||
|
if(~isempty(r.acc))
|
|||
|
subplot(2,2,i);
|
|||
|
i = i+1;
|
|||
|
interial_display(r.time, r.acc, {'X', 'Y', 'Z'}, 'Time (s)', 'Acceleration', 'Accelerometer');
|
|||
|
end
|
|||
|
|
|||
|
if(~isempty(r.mag))
|
|||
|
subplot(2,2,i);
|
|||
|
i = i+1;
|
|||
|
interial_display(r.time, r.mag, {'X', 'Y', 'Z'}, 'Time (s)', 'Flux ', 'Magnetometer');
|
|||
|
end
|
|||
|
|
|||
|
if(~isempty(r.eul))
|
|||
|
subplot(2,2,i);
|
|||
|
i = i+1;
|
|||
|
interial_display(r.time, r.eul, {'X', 'Y', 'Z'}, 'Time (s)', 'Angle(deg)', 'Eular Angle');
|
|||
|
end
|
|||
|
|
|||
|
if(~isempty(r.wb))
|
|||
|
subplot(2,2,i);
|
|||
|
i = i+1;
|
|||
|
interial_display(r.time, r.wb, {'X', 'Y', 'Z'}, 'Time (s)', 'Angle(deg)', '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ');
|
|||
|
end
|
|||
|
|
|||
|
if(~isempty(r.gb))
|
|||
|
subplot(2,2,i);
|
|||
|
i = i+1;
|
|||
|
interial_display(r.time, r.gb, {'X', 'Y', 'Z'}, 'Time (s)', 'm/s^(2)', '<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD><EFBFBD><EFBFBD>ƫ');
|
|||
|
end
|
|||
|
|
|||
|
if(~isempty(r.phi))
|
|||
|
subplot(2,2,i);
|
|||
|
i = i+1;
|
|||
|
interial_display(r.time, r.phi, {'X', 'Y', 'Z'}, 'Time (s)', 'Angle(deg)', 'ʧ<EFBFBD><EFBFBD>');
|
|||
|
end
|
|||
|
|
|||
|
if(~isempty(r.P_phi))
|
|||
|
subplot(2,2,i);
|
|||
|
i = i+1;
|
|||
|
interial_display(r.time, r.P_phi, {'X', 'Y', 'Z'}, 'Time (s)', '-', 'Phi Var(ʧ<CAA7>Ƿ<EFBFBD><C7B7><EFBFBD>)');
|
|||
|
end
|
|||
|
|
|||
|
|
|||
|
if(~isempty(r.P_wb))
|
|||
|
subplot(2,2,i);
|
|||
|
i = i+1;
|
|||
|
interial_display(r.time, r.P_wb, {'X', 'Y', 'Z'}, 'Time (s)', '-', '<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end
|
|||
|
|
|||
|
|
|||
|
if(~isempty(r.P_pos))
|
|||
|
subplot(2,2,i);
|
|||
|
interial_display(r.time, r.P_pos, {'X', 'Y', 'Z'}, 'Time (s)', '-', 'λ<EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
end
|
|||
|
|
|||
|
% linkaxes(axis, 'x');
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
|
|||
|
function interial_display(time, data, legendstr, xlabelstr, ylabelstr, titlestr)
|
|||
|
hold on;
|
|||
|
plot(time, data(:,1), 'r');
|
|||
|
plot(time, data(:,2), 'g');
|
|||
|
plot(time, data(:,3), 'b');
|
|||
|
legend(legendstr);
|
|||
|
xlabel(xlabelstr);
|
|||
|
ylabel(ylabelstr);
|
|||
|
title(titlestr);
|
|||
|
hold off;
|
|||
|
end
|