MATLAB Bode Plot Generator (Under Construction)

Under Construction

Introduction

This MATLAB function generates Bode plots based on a user-defined frequency sweep. It requires the Data Acquisition Toolbox and an Analog Discovery 2 to generate and capture the signals. The user defines the start, stop, and the number of frequency samples per decade in the frequency sweep.

The highest frequency sweep range is limited at 500kHz due to the Data Acquisition Toolbox's sampling rate restriction, which is capped at 1MHz. If higher sampling rates are needed, please use the Network Analyzer tool in Digilent's free application WaveForms.


Inventory


Setup

Open the file “freqSweep.m” and call the function freqSweep() from MATLAB's Command Window. This function has the following syntax:

freqSweep(start,stop,samplesPerDec)

Parameter Description
start Optional. Frequency sweep start value (Hz)
stop Optional. Frequency sweep stop value (Hz)
samplesPerDec Optional. Specifies number of samples to take per decade

The function defaults to a 10Hz-100kHz sweep with 10 samples per decade if no parameters are passed.


This function is configured so that the Analog Discovery Oscilloscope Channel 1 (solid orange wire) senses the input signal, and Channel 2 (solid blue wire) senses the output signal. The negative leads (marked with a white stripe) and a black ground wire should be connected to the ground of the network under test. The Function Generator Channel 1 (solid yellow wire) is used as the input signal and should be connected at the same place as Oscilloscope Channel 1. See the diagram to the right.


An example of data captured, processed and plotted by this function can be seen to the right.


Final Notes

For more guides and example projects for your Test and Measurement device, please visit its Resource Center, which can be found through this wiki's Test and Measurement page.

For technical support, please visit the Digilent Forums.