-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotPertHitSmooth.m
43 lines (40 loc) · 2.08 KB
/
plotPertHitSmooth.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
function plotPertHitSmooth(extractData, time_of_interest)
for i = 1 : length(extractData.posHitPert) % plot all hit trials
subplot(2,2,1)
q = plot([0:extractData.sampleTime:(extractData.sampleTime*length(extractData.posHitPert{i})-extractData.sampleTime)], extractData.posHitPert{i}, 'g');
q.Color(4) = 0.4;
xlim([0 time_of_interest])
plotTitle = sprintf('%s knob angle trajectories, %s, %s, pert = %s%%', extractData.subject, extractData.date, extractData.session, extractData.pertMagnitude);
title(plotTitle)
xlabel('Time (ms)')
ylabel('Angle (deg)')
hold on
subplot(2,2,2)
smoothVel = cellfun(@smooth, extractData.velHitPert, 'UniformOutput', 0);
q = plot([0:extractData.sampleTime:(extractData.sampleTime*length(extractData.velHitPert{i})-extractData.sampleTime)], smoothVel{i}, 'g');
q.Color(4) = 0.4;
xlim([0 time_of_interest])
plotTitle = sprintf('%s knob velocity trajectories, %s, %s, pert = %s%%', extractData.subject, extractData.date, extractData.session, extractData.pertMagnitude);
title(plotTitle)
xlabel('Time (ms)')
ylabel('Velocity (deg / s)')
hold on
subplot(2,2,3)
if length(extractData.velHitPert{i}) > 1
q = plot([0:extractData.sampleTime:(extractData.sampleTime*length(extractData.velHitPert{i})-2*extractData.sampleTime)], diff(smoothVel{i}) / (extractData.sampleTime * 1e-3), 'g');
q.Color(4) = 0.4;
xlim([0 time_of_interest])
plotTitle = sprintf('%s knob acceleration trajectories, %s, %s, pert = %s%%', extractData.subject, extractData.date, extractData.session, extractData.pertMagnitude);
title(plotTitle)
xlabel('Time (ms)')
ylabel('Acceleration (deg / s^2)')
hold on
end
subplot(2,2,4)
plot([0:extractData.sampleTime:(extractData.sampleTime*length(extractData.pertCurrent{i})-extractData.sampleTime)],extractData.pertCurrent{i}, 'k')
xlim([0 time_of_interest])
hold on
title('Perturbation current for successful perturbed trials')
xlabel('Time (ms)')
ylabel('% of max Amp * 10V (output)')
end