-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotData.m
59 lines (44 loc) · 1.02 KB
/
plotData.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
%% 对采集的数据进行绘图
% first input : the data used to plot
% second input : enable plot ,plot when equal 1
%%
function plotData(varargin)
nVarargs = length(varargin);
if nVarargs==0
errordlg('没有可用的数据')
return;
end
if nVarargs == 1
data = varargin{1};
ifplot = 1;
end
if nVarargs == 2
data = varargin{1};
ifplot = varargin{2};
end
if nVarargs >2
errordlg('输入的变量过多')
return;
end
if ifplot
figure('Name','原始数据曲线','NumberTitle','off')
time = data.timeMS/1000;
subplot(3,1,1)
plot(time,data.accX,time,data.accY,time,data.accZ)
legend('accX','accY','accZ')
xlabel('time/s')
ylabel('g')
grid on
subplot(3,1,2)
plot(time,data.gyroX,time,data.gyroY,time,data.gyroZ)
legend('gyroX','gyroY','gyroZ')
xlabel('time/s')
ylabel('deg/s')
grid on
subplot(3,1,3)
plot(time,data.roll,time,data.pitch,time,data.yaw)
legend('roll','pitch','yaw')
xlabel('time/s')
ylabel('deg')
grid on
end