|
- function data = transferFunction(oscilloscope,functiongenerator,f_start,f_stop,n_steps,amplitude)
- %TRANSFERFUNCTION Summary of this function goes here
- % Detailed explanation goes here
-
- f_array = linspace(f_start,f_stop,n_steps);
- functiongenerator.voltage = amplitude;
- functiongenerator.waveform = 'SINUSOID';
- oscilloscope.enable_channels;
- oscilloscope.trigger.source = 'CH1';
- oscilloscope.ch1.type = 'HRES';
- oscilloscope.ch2.type = 'HRES';
- oscilloscope.setMeasurement(1,'phase');
- oscilloscope.setMeasurement(2,'peak');
- oscilloscope.setMeasurement(3,'peak','ch2');
- emptydata = zeros(n_steps,1);
- data = struct('magnitude',emptydata,'phase',emptydata,'frequency',f_array);
- for i = 1:n_steps
- functiongenerator.frequency = f_array(i);
- oscilloscope.auto;
- data.phase(i) = oscilloscope.getMeasurement(1);
- data.magnitude(i) = oscilloscope.getMeasurement(2)/oscilloscope.getMeasurement(3);
- end
- end
|