-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_haptic_data.m
40 lines (40 loc) · 1.02 KB
/
plot_haptic_data.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
close all
figure
subplot(3,1,1)
plot(rpm(:,1), rpm(:,2))
title('RAW encoder RPM computed data')
xlabel('Time (s)')
ylabel('RPM')
%axis([0 max(rpm(:,1)) 0 100])
rpm_filter = medfilt1(rpm(:,2), 3);
rpm_filter = smooth(rpm(:,1), rpm_filter, .02, 'loess');
subplot(3,1,2)
plot(rpm(:,1), rpm_filter)
axis([0 max(rpm(:,1)) 60 80])
title('FILTERED encoder RPM computed data')
xlabel('Time (s)')
ylabel('RPM')
%axis([0 max(rpm(:,1)) 0 inf])
subplot(3,1,3)
plot(pwm_signal(:,1), pwm_signal(:,2))
title('Generated PWM Signal')
xlabel('Time (s)')
ylabel('RPM')
figure
subplot(3,1,1)
plot(pwm_signal(:,1), pwm_signal(:,2))
title('Generated PWM Signal')
xlabel('Time (s)')
ylabel('RPM')
subplot(3,1,2)
plot(currentSense(:,1), currentSense(:,2)*(1000/140))
title('Current Sensed')
xlabel('Time (s)')
ylabel('Current (A)')
subplot(3,1,3)
I_filter = smooth(currentSense(:,1), currentSense(:,2), .02, 'loess');
plot(currentSense(:,1), I_filter*(1000/140))
axis([0 max(rpm(:,1)) .2 1])
title('Current Sensed SMOOTHED')
xlabel('Time (s)')
ylabel('Current (A)')