-
Notifications
You must be signed in to change notification settings - Fork 1
/
heaterResistanceRepeatabilityKeysight.m
68 lines (65 loc) · 1.96 KB
/
heaterResistanceRepeatabilityKeysight.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
clear;
delete (instrfindall); % Delete all existing instruments
kes = kes_start(); % Initialize and connect keithley
%%
kes_config_I_source(kes, 0.1)
kes_set_I(kes, 0.1);
[twoWire, fourWire] = kes_contact_resistance(kes);
contact = twoWire - fourWire;
fprintf("2-wire = %f, 4-wire = %f, diference = %f \n", twoWire, fourWire, contact);
%% Current sweep, with repeats.
numRepeats = 10;
i_min = 0;
i_max = 100;
i_step = 5;
i_list = i_min:i_step:i_max;
i_num = length(i_list);
v_comp = 100;
i_comp = i_max;
settle_time = 0;
time_between_repeats = 10;
function_handle = @doNothing;
kes_set_4wire(kes, true);
saveArray = zeros(i_num, 2, numRepeats);
for repeatIdx = 1:numRepeats
thisList = i_list;
% if(mod(repeatIdx,2))
% thisList = i_list;
% else
% thisList = flip(i_list);
% end
[measured_V, measured_I, ~] = kes_do_I_list(...
kes, thisList, v_comp, i_comp, settle_time, function_handle);
saveArray(:, :, repeatIdx) = [measured_V,measured_I];
pause(time_between_repeats);
end
%% Plot repeats overlaid
figure; hold on;
colors = cool(numRepeats);
for repeatIdx = 1:numRepeats
plot(saveArray(2:end,1,repeatIdx)./saveArray(2:end,2,repeatIdx), "Color", colors(repeatIdx, :));
end
%% Random list
numIndividPts = 500;
i_list = i_max * rand(numIndividPts);
[measured_V, measured_I, ~] = kes_do_I_list(...
kes, i_list, v_comp, i_comp, settle_time, function_handle);
%%
%plot(measured_I, measured_V, '.');
plot(measured_I, measured_V./measured_I, '.');
%% save result
[output_filename, output_path] = uiputfile('*', 'Select location to save data:');
if(output_filename)
save(strcat(output_path,output_filename), 'saveArray', 'settle_time');
else
disp("File save cancelled");
end
%% save random result
[output_filename, output_path] = uiputfile('*', 'Select location to save data:');
if(output_filename)
save(strcat(output_path,output_filename), 'measured_I', 'measured_V');
else
disp("File save cancelled");
end
function doNothing()
end