Upload
tranliem
View
244
Download
7
Embed Size (px)
Citation preview
1 © 2013 The MathWorks, Inc.
Software Defined Radio in MATLAB®
Mike McLernon
MathWorks, Inc.
5/17/2013
2
Agenda
Simulink® QPSK Transceiver
MATLAB System Objects
MATLAB Transceiver
3
Simulink QPSK Transceiver
4
Transmitter
5
Channel
6
7
QPSK Transmitter and Receiver with USRP®
Radios
8
Agenda
Simulink QPSK Transceiver
MATLAB System Objects
MATLAB Transceiver
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
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)
11
Agenda
Simulink QPSK Transceiver
MATLAB System Objects
MATLAB Transceiver
12
MATLAB Transceiver
As Obi-Wan would say, “Use the source, Luke!”
13
Demo
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
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
16
Conclusion
Connect to USRP radios with either MATLAB or
Simulink