16
1 © 2013 The MathWorks, Inc. Software Defined Radio in MATLAB® Mike McLernon MathWorks, Inc. [email protected] 5/17/2013

Building an SDR Transceiver in MATLAB

Embed Size (px)

Citation preview

Page 1: Building an SDR Transceiver in MATLAB

1 © 2013 The MathWorks, Inc.

Software Defined Radio in MATLAB®

Mike McLernon

MathWorks, Inc.

[email protected]

5/17/2013

Page 2: Building an SDR Transceiver in MATLAB

2

Agenda

Simulink® QPSK Transceiver

MATLAB System Objects

MATLAB Transceiver

Page 3: Building an SDR Transceiver in MATLAB

3

Simulink QPSK Transceiver

Page 4: Building an SDR Transceiver in MATLAB

4

Transmitter

Page 5: Building an SDR Transceiver in MATLAB

5

Channel

Page 6: Building an SDR Transceiver in MATLAB

6

Page 7: Building an SDR Transceiver in MATLAB

7

QPSK Transmitter and Receiver with USRP®

Radios

Page 8: Building an SDR Transceiver in MATLAB

8

Agenda

Simulink QPSK Transceiver

MATLAB System Objects

MATLAB Transceiver

Page 9: Building an SDR Transceiver in MATLAB

9

MATLAB System Objects™

Support for streaming data

Automatic state handling (for the user, not the author)

Consistent API for setup and execution

Initialization phase is separated from the execution

phase

Code generation for desktop acceleration

Build hierarchical systems in MATLAB

Page 10: Building an SDR Transceiver in MATLAB

10

A System Object Example

% Create adaptive filter object

hlms = dsp.LMSFilter(11, 'StepSize', 0.01);

% Create system to be identified... an FIR filter.

hfilt = dsp.DigitalFilter('TransferFunction', 'FIR (all zeros)', ...

'Numerator', fir1(10, .25));

% Run 10 iterations of filter adaptation

diff = zeros(10,1);

for i = 1:10

% Input to the system

x = randn(100,1);

% Measure some output to the system, including noise

d = step(hfilt, x) + 0.01*randn(100,1);

% Now let's run our adaptive filter

[y,~,w] = step(hlms, x, d);

% Compare the measured and identified outputs

diff(i) = sqrt(sum((y-d).^2));

end

plot(diff)

Page 11: Building an SDR Transceiver in MATLAB

11

Agenda

Simulink QPSK Transceiver

MATLAB System Objects

MATLAB Transceiver

Page 12: Building an SDR Transceiver in MATLAB

12

MATLAB Transceiver

As Obi-Wan would say, “Use the source, Luke!”

Page 13: Building an SDR Transceiver in MATLAB

13

Demo

Page 14: Building an SDR Transceiver in MATLAB

14

Connecting to the USRP Radio in MATLAB

Use System objects to transmit or receive data

– Define IP address

– Define center frequency, gain, interpolation/decimation, LO

offset

– Generate code for acceleration

– Burst mode for transmitter and receiver

Page 15: Building an SDR Transceiver in MATLAB

15

USRP System Objects

comm.SDRuTransmitter

Properties:

IPAddress: '192.168.10.2'

CenterFrequencySource: 'Property'

CenterFrequency: 2450000000

ActualCenterFrequency: 2450000000

LocalOscillatorOffsetSource: 'Property'

LocalOscillatorOffset: 0

ActualLocalOscillatorOffset: 0

GainSource: 'Property'

Gain: 8

ActualGain: 8

InterpolationFactorSource: 'Property'

InterpolationFactor: 512

ActualInterpolationFactor: 512

UnderrunOutputPort: false

EnableBurstMode: false

comm.SDRuReceiver

Properties:

IPAddress: '192.168.10.2'

CenterFrequencySource: 'Property'

CenterFrequency: 2450000000

ActualCenterFrequency: 2450000000

LocalOscillatorOffsetSource: 'Property'

LocalOscillatorOffset: 0

ActualLocalOscillatorOffset: 0

GainSource: 'Property'

Gain: 8

ActualGain: 8

DecimationFactorSource: 'Property'

DecimationFactor: 512

ActualDecimationFactor: 512

OverrunOutputPort: false

SampleRate: 1

OutputDataType: 'int16'

FrameLength: 362

Page 16: Building an SDR Transceiver in MATLAB

16

Conclusion

Connect to USRP radios with either MATLAB or

Simulink