oscilloscope.run;
functiongenerator.frequency = frequency;
functiongenerator.voltage = amplitude;
functiongenerator.waveform = waveform;
oscilloscope.trigger.source='ch1';
oscilloscope.trigger.hfreject = 'on';
clear ax;
oscilloscope.auto;
wave = oscilloscope.waveform;
T = wave.sampletime;
t = (0:T:T*(wave.length-1))*1000;
ch1 = wave.ch1;
ch2 = wave.ch2.*attenuation;
figure;
plot(t,ch1,t,ch2);
title('Waveforms from Oscillscope')
legend('Channel 1','Channel 2');
xlabel('Time [ms]');
ylabel('Amplitude [V]');
ax(1) = gca;
figure;
ax(2) = subplot(2,1,1);
plot(t,ch1)
xlabel('Time [ms]');
ylabel('Amplitude [V]');
title('Channel 1 from Oscillscope')
ax(3) = subplot(2,1,2);
plot(t,ch2)
xlabel('Time [ms]');
ylabel('Amplitude [V]');
title('Channel 2 from Oscillscope')
linkaxes(ax(2:3));
arrayfun(@(x) set(x,{'XGrid','YGrid'},{'on','on'}),ax)
