-
Notifications
You must be signed in to change notification settings - Fork 0
/
SetSignal.m
50 lines (39 loc) · 1.21 KB
/
SetSignal.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
function SetSignal(GenObj, param, freq, burstN, volt)
fopen(GenObj);
% disp('in generator')
try
dg = @(command) fprintf(GenObj, command);
dg(':SYST:POW')
dg(':OUTP1:LOAD 50');
dg(':OUTP2:LOAD 50');
switch param
case 'f'
dg([':SOUR1:FREQ ' num2str(freq) 'E6']);
dg([':SOUR2:FREQ ' num2str(freq) 'E6']);
case 'b'
dg(':SOUR1:BURS ON');
dg([':SOUR1:BURS:NCYC ' num2str(burstN)]);
dg(':SOUR2:BURS ON');
dg([':SOUR2:BURS:NCYC ' num2str(burstN)]);
case 'v'
num2str(volt)
dg([':SOUR1:VOLT ' num2str(volt)]);
dg([':SOUR2:VOLT ',num2str(10)]);
end
dg(':SOUR1:BURS:INT:PER 1E-3');
dg(':SOUR2:BURS:INT:PER 1E-3');
dg(':OUTP1 ON');
dg(':OUTP2 ON');
dg(':SOUR1:PHAS:INIT');
dg(':SOUR2:PHAS:SYNC');
catch e
fclose(GenObj);
delete(GenObj);
clear GenObj;
disp(e)
return
end
pause(0.1); %For reaction time of the Signal change
fclose(GenObj);
% disp('out generator')
end