MATLAB: Spectrum Analyzer

Example MATLAB script to implement the Spectrum Analyzer

%% Basic Spectrum Analyzer
%
% This example demonstrates how you can use the Spectrum Analyzer instrument
% to retrieve a single spectrum data frame over a set frequency span.
%
% (c) 2017 Liquid Instruments Pty. Ltd.
%
%% Connect to your Moku
ip = input('Please enter your Moku:Lab IP address: ', 's');

% Connect to your Moku and deploy the desired instrument
m = MokuSpectrumAnalyzer(ip);

%% Configure the instrument
% Set the frequency span from DC - 10MHz
m.set_span(0,100e6);

%% Get data
% Get a spectrum data frame
data = m.get_data();

% Print the results out
data.frequency
data.ch1
data.ch2