forked from nicolassmith/lentickle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlentickleSweep.m
34 lines (29 loc) · 1 KB
/
lentickleSweep.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
% [x, sensDC, sigDC, fDC] = lentickleSweep(cucumber, ...
% dofName, sweepStart, sweepEnd, numPoint)
%
% calls sweepLinear with arguments constructed to sweep the given DOF
%
% the results are from sweepLinear, with
% x = DOF position values from sweepStart to sweepEnd
% sensDC = cucumber.probeSens * sigDC
function [x, sensDC, sigDC, fDC] = lentickleSweep(cucumber, ...
dofName, sweepStart, sweepEnd, numPoint)
% convert name to index
if ischar(dofName)
nDof = find(strcmp(dofName, cucumber.dofNames), 1);
if isempty(nDof)
error('No match for DOF %s', dofName)
end
elseif isnumeric(dofName) && numel(dofName) == 1
nDof = dofName;
else
error('Ambiguous dofName (must be string, or integer)')
end
% make pos vector
x = sweepStart + (sweepEnd - sweepStart) * (0:numPoint - 1)' / (numPoint - 1);
pos = cucumber.mirrDrive * cucumber.dofMirr(:, nDof) * x';
% sweep
[fDC, sigDC] = sweep(cucumber.opt, pos);
% make sensDC
sensDC = cucumber.probeSens * sigDC;
end