- /
-
Eigenwalker
on 11 Nov 2023
- 29
- 173
- 5
- 1
- 1425
drawframe(1);
Write your drawframe function below
function drawframe(f)
% EIGENWALKER Human gait
% Cleve's Corner, http://blogs.mathworks.com/cleve/2016/04/11.
period = 151.5751;
omega = 2*pi/period;
fps = 48;
dt = 2*pi/omega/fps;
scale = 0.1;
t = (f-1)*dt;
c = scale*[1 sin(omega*t) cos(omega*t) sin(2*omega*t) cos(2*omega*t)]';
V = coefficients;
X = reshape(V*c,15,3);
L = {[1 5],[5 12],[2 3 4 5 6 7 8],[9 10 11 12 13 14 15]};
p = zeros(4,1);
cla
axis([-750 750 -750 750 0 1500])
set(gca,'xtick',[],'ytick',[],'ztick',[])
for k = 1:4
p(k) = line(X(L{k},1),X(L{k},2),X(L{k},3), ...
'color',[0 2 3]/4, ......
'marker','o','markersize',8, ...
'linestyle','-','linewidth',1.5);
end
XH = [X(1,:); X(5,:)];
set(p(1),'xdata',XH(:,1),'ydata',XH(:,2),'zdata',XH(:,3))
view(160,10)
function V = coefficients
V = [ 5 -43 -182 0 1
2064 14 -131 11 39
2092 -215 -192 28 15
1660 -72 -173 -1 3
-7 -78 -173 2 1
-1664 -79 -178 4 -3
-2097 -246 -200 -28 -20
-2016 -36 -168 -19 -49
536 53 127 0 15
794 11 83 -3 47
931 -73 -145 1 -2
20 -63 -113 1 0
-883 -74 -146 1 -1
-831 17 74 2 -47
-567 61 125 0 -20
205 -11 -4 -37 27
500 -1010 -256 37 9
-686 -606 -174 -11 17
-59 -153 -52 -57 32
-114 -7 -4 -62 35
-177 139 44 -61 34
-717 691 170 -12 16
414 1174 254 36 0
-544 2214 -576 327 -259
859 1247 170 51 264
-42 -10 -29 -115 80
78 -10 0 -115 67
-58 -10 33 -116 79
832 -1240 -175 56 266
-557 -2227 586 349 -271
13837 1 0 70 86
7695 -189 -11 124 6
9721 61 44 82 59
12251 -20 22 76 85
12058 1 0 74 85
12320 21 -23 78 82
9774 -65 -39 83 49
7766 224 17 119 -23
984 -120 548 -105 266
4122 250 49 123 30
7897 -12 -31 70 84
8766 1 1 70 87
7889 13 32 70 86
4157 -249 -52 124 35
985 127 -548 -116 269];
end
end