Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Knowledge Base Home
  • Contact Us
  • Home
  • Moku:Lab
  • Software integrations
  • MATLAB examples

MATLAB: Arbitrary Waveform Generator

Written by Paul Cracknell

Updated at February 10th, 2021

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Moku:Go
    Moku:Go Arbitrary Waveform Generator Moku:Go Data Logger Moku:Go Frequency Response Analyzer Moku:Go Logic Analyzer & Pattern Generator Moku:Go Oscilloscope & Voltmeter Moku:Go PID Controller Moku:Go Spectrum Analyzer Moku:Go Waveform Generator Moku:Go Power Supplies Moku:Go Digital Filter Box Moku:Go FIR Filter Builder Moku:Go Lock-in Amplifier
  • Moku:Lab
    Windows Moku:Lab general Moku:Lab Instruments iPad app Software integrations
  • Moku:Pro
    Moku:Pro Instruments
+ More

Example MATLAB script to implement the Arbitrary Waveform Generator

%% Arbitrary Waveform Generator Basic Example
%
% This example demonstrates how you can generate and output arbitrary
% waveforms using the Arbitrary Waveform Generator instrument.
%
% (c) 2017 Liquid Instruments Pty. Ltd.
%
%% Prepare the waveforms
% Prepare a square waveform to be generated
t = linspace(0,1,100);
square_wave = sign(sin(2*pi*t));

% Prepare a more interesting waveform to be generated (note that the points
% must be normalized to range [-1,1])
not_square_wave = zeros(1,length(t));
for h=1:2:15
 not_square_wave = not_square_wave + (4/pi*h)*cos(2*pi*h*t);
end
not_square_wave = not_square_wave / max(not_square_wave);

%% Connect to your Moku
ip = input('Please enter your Moku:Lab IP address: ', 's');

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

%% Configure the instrument
% Load the waveforms to the device. This doesn't yet generate an output as
% we haven't set the amplitude, frequency etc; this only defines the shape.
m.write_lut(1, not_square_wave);
m.write_lut(2, square_wave);

% Generate the waveforms
% We have configurable on-device linear interpolation between LUT points.
% Normally interpolation is a good idea, but for sharp edges like square
% waves it will improve jitter but reduce rise-time. Configure whatever's
% suitable for your application.
m.gen_waveform(1, 1e-6, 1.0, 'interpolation','true');
m.gen_waveform(2, 1e-6, 1.0, 'interpolation','true');
moku:lab

Was this article helpful?

Yes
No

Related Articles

  • MATLAB datalogger and saving the logfile
  • MATLAB: Data Logger (basic)
  • MATLAB: Waveform Generator
  • MATLAB: IIR Filter Box

Sitemap

  • Moku:Lab
  • Instruments
  • Software
  • Company
  • Support
  • Store
  • Terms & Conditions
  • Privacy Policy

Offices

United States
+1 (619) 332-6230
740 Lomas Santa Fe Dr
Suite 102
Solana Beach, CA 92075

Australia
+61 2 6171 9730
243 Northbourne Avenue
Suite 2
Lyneham, ACT 2602

Follow us

Youtube LinkedIn

官方微信

Contact us
© 2021 Liquid Instruments. All rights reserved.

Definition by Author

0
0
Expand