-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_loops_individual.m
More file actions
46 lines (41 loc) · 958 Bytes
/
plot_loops_individual.m
File metadata and controls
46 lines (41 loc) · 958 Bytes
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
function [] = plot_loops_individual(loops, normalise)
% set default values
if ~exist('normalise', 'var') || isempty(normalise)
normalise = false;
end
n = size(loops, 1);
x = loops.x;
Ffr = loops.Ffr;
t = loops.t;
CL = loops.CL;
X = loops.X;
% plot the x vs. Ffr
figure;
for i = 1:n
subplot(sqrt(n),sqrt(n),i)
plot(x(i,:), Ffr(i,:), 'b.');
hold on;
plot(x(i,1), Ffr(i,1), 'rx');
if ~normalise
yline(CL(i), '--r');
yline(-CL(i), '--r');
xlim([-max(X) max(X)]);
ylim([-max(Ffr(:)) max(Ffr(:))]);
end
xlabel('Relative Displacement [\mu m]');
if mod(i,sqrt(n)) == 1
ylabel('Friction Force [N]');
end
end
figure;
for i = 1:n
subplot(sqrt(n),sqrt(n),i)
plot(t(i,:),x(i,:),'.');
hold on;
plot(t(i,:),Ffr(i,:),'.');
xlabel('Time [s]');
yline(CL(i), '--r');
yline(-CL(i), '--r');
legend('Relative Displacement [\mu m]', 'Friction Force [N]');
end
end