-
Notifications
You must be signed in to change notification settings - Fork 2
/
gaitPlot.m
92 lines (68 loc) · 1.84 KB
/
gaitPlot.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
function gaitPlot (solution)
% make graphs from an optimization result
% example:
% report('solution.mat')
% keyboard
% initialize figure window
% close all
figure(1);
set(gcf,'Position',[5 5 815 960]);
% Loading the Result structure form the mat-file specified
x = solution.phase.state;
u = solution.phase.control;
t = solution.phase.time;
% Computing ground reaction forces
% xx=guess.phase.state;
% uu=guess.phase.control;
[~, GRF] = gait2dem(x',u');
% plot the horizontal ground reaction force Fx, right and left
subplot(3,3,1);
plot(t, GRF([1 4],:));
legend('Right','Left');
xlabel('time (s)');
ylabel('force (N)');
title('Horizontal GRF');
% plot the hip angles, right and left
subplot(3,3,2);
plot(t, x(:,[4 7])*180/pi);
xlabel('time (s)');
ylabel('angle (deg)');
title('Hip Angle');
% plot the hip torques, right and left
subplot(3,3,3);
plot(t, u(:,[4 7]));
xlabel('time (s)');
ylabel('torque (N.m)');
title('Hip Torque');
% plot the vertical ground reaction force Fy, right and left
subplot(3,3,4);
plot(t, GRF([2 4],:));
legend('Right','Left');
xlabel('time (s)');
ylabel('force (N)');
title('Vertical GRF');
% plot the knee angles, right and left
subplot(3,3,5);
plot(t, x(:,[5 8])*180/pi);
xlabel('time (s)');
ylabel('angle (deg)');
title('Knee Angle');
% plot the knee torques, right and left
subplot(3,3,6);
plot(t, u(:,[5 8]));
xlabel('time (s)');
ylabel('torque (N.m)');
title('Knee Torque');
% plot the ankle angles, right and left
subplot(3,3,8);
plot(t, x(:,[6 9])*180/pi);
xlabel('time (s)');
ylabel('angle (deg)');
title('Ankle Angle');
% plot the ankle torques, right and left
subplot(3,3,9);
plot(t, u(:,[6 9]));
xlabel('time (s)');
ylabel('torque (N.m)');
title('Ankle Torque');
end