|
|
|
@@ -1,6 +1,12 @@ |
|
|
|
function data = transferFunction(oscilloscope,functiongenerator,f_start,f_stop,amplitude,n_steps,n_measurements) |
|
|
|
function data = transferFunction(oscilloscope,functiongenerator,f_start,f_stop,amplitude,n_steps,n_measurements,type) |
|
|
|
%TRANSFERFUNCTION Summary of this function goes here |
|
|
|
% Detailed explanation goes here |
|
|
|
if nargin < 8 |
|
|
|
type = 'HRES'; |
|
|
|
if nargin < 7 |
|
|
|
n_measurements = 1; |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
f_array = 10.^linspace(log10(f_start),log10(f_stop),n_steps); |
|
|
|
functiongenerator.voltage = amplitude; |
|
|
|
@@ -13,12 +19,14 @@ function data = transferFunction(oscilloscope,functiongenerator,f_start,f_stop,a |
|
|
|
for i = 1:n_steps |
|
|
|
% fprintf('Measurement %i of %i - Frequency: %.2f Hertz\n',i,n_steps,f_array(i)); |
|
|
|
functiongenerator.frequency = f_array(i); |
|
|
|
oscilloscope.message(['Run: ' num2str(j) '/' num2str(n_measurements) ' - Step: ' num2str(i) '/' num2str(n_steps)]) |
|
|
|
oscilloscope.run; |
|
|
|
oscilloscope.auto; |
|
|
|
wavedata = oscilloscope.waveform(1:2,'DEF','SAMP'); |
|
|
|
wavedata = oscilloscope.waveform(1:2,'DEF',type); |
|
|
|
[data.phase(j,i),data.magnitude(j,i)] = phamag(wavedata.ch1,wavedata.ch2,wavedata.length,f_array(i),wavedata.sampletime); |
|
|
|
end |
|
|
|
end |
|
|
|
oscilloscope.message('Measurement Finished!'); |
|
|
|
%bodePlot(data.magnitude,data.phase,data.frequency) |
|
|
|
end |
|
|
|
|