Last active
January 18, 2024 02:38
-
-
Save wjladams/665198be672155e5b0e3b830a72a3a52 to your computer and use it in GitHub Desktop.
Some matlab code to read from a cool device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% lock in script | |
% to run script the NI-488.2 driver is nessary | |
%lockinamp is the stanford research systems model sr810 dsp lock-in | |
%amplifier | |
%funcgen is the rohde & schwarz signal generator smy01 | |
lockinamp = 0; | |
funcgen = 0; | |
lockinamp = visadev("GPIB0::8::INSTR"); | |
funcgen = visadev("GPIB0::28::INSTR"); | |
stfr = 18500; | |
enfr = 30500; | |
size_of_data = (enfr - stfr)*5*10; | |
data = zeros(1,size_of_data; | |
writeline(lockinamp, "send {0}"); | |
writeline(lockinamp, "srat {4}"); | |
setfreq = "af " + stfr; | |
writeline(funcgen, setfreq); | |
pause(20) | |
i = 1; | |
while stfr < enfr | |
writeline(lockinamp, "snap ? 1,2,9") | |
data(i) = str2num(readline(lockinamp)); | |
i = i + 1; | |
if i > size_of_data | |
fprintf("We overran our data buffer, stopping") | |
break | |
end | |
pause(2) | |
stfr = stfr +0.2; | |
setfreq = "af " + stfr; | |
writeline(funcgen,setfreq); | |
save("07_19_23mg18-30khz.mat","data") | |
end | |
writeline(funcgen,"af 10000"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment