Tutorial Matlab Application
Tutorial Matlab Application
Tutorial Matlab Application
MATLAB Application
MG3700A
Vector Signal Generator
Slide 1
Contents
Introduction 3 Modulation Basics 5 Understanding Signal Pattern File 10 Programming Examples to Create I/Q Data File 18
Analog Modulation Pulse Modulation PSK, QAM Simulink 19 26 35 46
Programming Example to Convert and Transfer I/Q Data File without IQproducer 68
MG3700A-E-F-11
Slide 2
Introduction
Electronic Design Automation (EDA) tools, such as MATLAB and Microwave Office, can save IQ simulation data to CSV text files.
Easy comparison between simulation and measured data
The IQproducer application software (MG3700A standard accessory) can import user I/Q sample data from CSV files into MG3700A, making it useful for various applications.
R&D into next-generation wireless systems, RFID, PWM, analog modulation such as AM, FM, and PM
User-specific Software
Processing (Simulating) signals using C program or EDA tools such as MATLAB Creating CSV files of baseband signals Converting to signal pattern files for MG3700A FTP
MG3700A-E-F-11
Slide 3
Introduction
MG3700A supports Arbitrary Waveform Generator (AWG) features
Sample rate (Fs)
20 k to 160 MHz
Waveform memory
2 128 Msample/channel (1 GB) 2 256 Msample/channel (2 GB) * with Option Memory upgrade
Dual baseband memory
DAC resolution
14 bits
Marker output
3 definable TTL
MG3700A-E-F-11
Slide 4
Modulation Basics
Modulation imposes source data on a passband signal with carrier frequency c by using amplitude and/or phase perturbations.
Amplitude
-fm
fm
fc-fm
fc
fc+fm
Baseband bandwidth
Passband bandwidth
MG3700A-E-F-11
Slide 5
Modulation Transmitter
AM-PM technique
m(t) Baseband circuits R(t) Baseband signal processor RF circuits v(t)=R(t) cos[ct+(t)]
(t)
cos(ct)
cos[ ct+(t)]
R(t ) = x 2 (t ) + y 2 (t )
Equivalent Baseband circuits x(t) I Baseband signal processor c cos(ct) -/2 shift y(t) Q sin(ct) + RF circuits
c=2c
MG3700A-E-F-11
Slide 6
Baseband Waveform
AM-PM IQ modulation
Modulation scheme
R(t)
(t)
x(t)
y(t)
Remark
AM
Ac[1+m(t)]
Ac[1+m(t)]
PM
Ac
Dpm(t)
Accos[Dpm(t)]
Acsin[Dpm(t)]
FM
Ac
D f m( )d
Ac cos D f m( )d
t
Ac sin D f m( )d
t
QM
Ac m1 (t ) + m2 (t )
tan 1
m2 (t ) m1 (t )
Acm1(t)
Acm2(t)
m1(t) = 1 m2(t) = 1
MG3700A-E-F-11
Slide 7
Baseband Signal
Any type of modulated signal may be generated using either the AMPM technique or quadrature technique. Any modulation scheme can be achieved by selecting the appropriate software algorithm. In a Vector Signal Generator (VSG), the passband signal s(t) is often partitioned into two channels, one for x(t) called the I (in-phase) channel and one for y(t) called the Q (quadrature-phase) channel. In digital computer simulations of passband signals, the sampling rate used in the simulation can be minimized by working with the baseband signal, instead of with the passband signal s(t), because the baseband signal is equivalent of the passband signal.
MG3700A-E-F-11
Slide 8
AM
Magnitude R(t)
Ac I Ac I
FM
Ac
PSK
Ac
-Ac
MG3700A-E-F-11
Slide 9
Text file to binary file Large <<< File size >>> Small I/Q data scaled to DAC input values. File header
FTP connection .wvd Binary file .wvi Text file Download Extract
FTP
HDD
CF
MG3700A-E-F-11
Slide 10
I/Q Data
The data file (.wvd) contains the I and Q data points (signed 14-bit integers for each I and Q data point). Each I/Q point equals one baseband waveform point. The MG3700A uses a 14-bit DAC to process each of the 2-byte integer values for the I and Q data points. The 14-bit DAC has a range of 0 to 16383, but MG3700A divides this range between positive and negative values.
I data Q data DAC DAC LPF LPF I Q
DAC range
----------------- 16383 ----------------- 8191 ----------------0
MG3700A-E-F-11
Slide 11
Q +8191
-8191
+1157 +1634 3 dB 11 dB
-8191
MG3700A-E-F-11
Slide 12
Marker Data
The marker data uses 4 bits per I/Q data point to set the state of the four markers either On (1) or Off (0) for each I/Q data point. The marker data consists of three event markers and an RF gate flag. When an event marker is active (On), it outputs a trigger signal at the rear-panel marker connector corresponding to active marker number 1 to 3. An RF gate flag is used for pulse modulation and drives the internal pulse modulator.
When I/Q data is imported without marker data, event markers are set automatically to inactive (Off), and the RF gate flag is set to active (On).
MG3700A-E-F-11
Slide 13
1 0 RF Gate flag
Burst power Specification -40 dBc Power at I/Q = 0 If the RF gate flag is not used, carrier leakage occurs. Specification -60 dBc (On/Off ratio > 60 dB) If the RF gate flag is used, the RF output is off. Power at RF gate flag Off
MG3700A-E-F-11
Slide 14
Timing
Because markers are set at each I/Q data point, the marker data contains the same number of samples as I/Q data points.
I/Q1 Gate1(1) RF I Baseband Generator Q I/Q Modulator Pulse Modulator RF Gate Delay Adjustment Marker 1 Marker 2 Marker 3 RF I/Q2 Gate2(0) I/Q3 Gate3(1) I/Q4 Gate4(1)
The time difference between the event markers output connector and RF connector is adjusted to be within 1 sample.
Slide 15
MG3700A-E-F-11
File Header
The data file (.wvd) and file header (.wvi) have the same file name. The MG3700A stores the files in same package folder. The file header contains settings for the ARB modulation format, such as sample rate, number of samples, I/Q DAC RMS value, etc.
When the MG3700A finds unspecified header settings, it either uses the default settings, or the settings from previous signal pattern if a signal pattern was played previously.
MG3700A-E-F-11
Slide 16
Sampling rate (sample per second) Fs: Sampling frequency expressed in Hz Sampling interval Ts=1/Fs: Time between samples in uniform sampling
Slide 17
MG3700A-E-F-11
Slide 18
Analog Modulation
Analog modulation schemes are most basic techniques and it is simple to create I/Q data.
Basic analog modulation schemes: Amplitude Modulation (AM) Frequency Modulation (FM) Phase Modulation (PM)
AM
FM
Q Ac
PM
Q Ac
Vp
Vp I Ac
MG3700A-E-F-11
Slide 19
AM
Modulation depth 80 [%]
Envelop R(t)
Modulated signal
c(t)
-2 t
MG3700A-E-F-11
Slide 20
10
AM Programming Example
I = x(t) = Ac[1+m(t)] = 1+ sin(2mt) Q = y(t) = 0
Ac: Carrier signal amplitude = 1 : Modulation depth = Modulating signal peak/Carrier signal peak (amplitude)
clear all, close all, clc fm = 1; % Modulating frequency [kHz] Depth = 0.8; % Modulating depth CSVfile = 'AM1kHzDepth80%.csv' DataPoints = 1000; Fs = fm*DataPoints % Sampling rate [kHz]
MG3700A-E-F-11
Slide 21
FM
60 Frequency deviation [kHz] 40 20 0 -20 -40 -60 t
Df
Peak frequency deviation 50 [kHz]
c(t)
MG3700A-E-F-11
Slide 22
11
FM Programming Example
I = x(t) = Q = y(t) =
t Ac cos D f m( )d t Ac sin D f m( )d
fm = 1; % Modulating frequency [kHz] Deviation = 50; % Peak frequency deviation [kHz] CSVfile = 'FM1kHzDeviation50kHz.csv' DataPoints = 1000; Fs = fm*DataPoints % Sampling rate [kHz]
MG3700A-E-F-11
Slide 23
PM
2 1.5 Phase deviation [ rad] 1 0.5 0 -0.5 -1 -1.5 -2
t
Carrier
Dp
Peak phase deviation 5 [rad] 1.6 [rad]
c(t)
s(t)
t
Modulated signal
MG3700A-E-F-11
Slide 24
12
PM Programming Example
I = x(t) = Ac cos[Dp m(t)] Q = y(t) = Ac sin[Dp m(t)] = cos[Dp sin(2mt)] = sin[Dp sin(2mt)]
fm = 1; % Modulating frequency [kHz] Deviation = 5; % Peak phase deviation [kHz] CSVfile = 'PM1kHzDeviation5rad.csv' DataPoints = 1000; Fs = fm*DataPoints % Sampling rate [kHz]
MG3700A-E-F-11
Slide 25
Pulse Modulation
Pulse modulation is used for radar and satellite signals using a combination with either FM or PM, and time-multiplexed burst signals.
PRF/PRR: Pulse repetition frequency, rate [pps], [pulse/s] Pulse period [s]: 1/PRF Pulse width, duration [s]: Including rise time Duty ratio, cycle [%]: Pulse width/Pulse period Pulses per burst [pulses/burst] Burst length [s] Burst period [s] Pulse period Rise time [s]
Pulse width Rise time
Burst period
MG3700A-E-F-11
Slide 26
13
Pulse Modulation
CW
Programming Example
I = x(t) = Ac = 1 Q = y(t) = Ac = 1
Ac: Carrier signal amplitude = 1 PRF: 700 [pps] Pulse width: 1 [s] Pulses/burst: 18 Burst period: 10 [s]
clear all, close all, clc PRF = 700; % [pps] PulseWidth = 1E-6; % [s] PulsesPerBurst = 18; % [pulses/burst] BurstPeriod = 10; % [s] CSVfile = 'Pulse700ppsW1us18ppbB10s.csv' zerofile = 'Pulse700ppsW1us18ppbB10sZero.csv' Fs = LCM(PRF,1/PulseWidth) % Number of samples W = PulseWidth*Fs; PulseGap = (1/PRF-PulseWidth)*Fs; (Continued on the next page) % Sampling rate [Hz], LCM: Least Common Multiple
MG3700A-E-F-11
Slide 27
Pulse Modulation
Programming Example
(Continued from previous page) I = [ ones(1,W+2) zeros(1,PulseGap-2) ]; Q = [ ones(1,W+2) zeros(1,PulseGap-2) ]; RFgateFlag = [ zeros(1,1) ones(1,W) zeros(1,PulseGap) ]; Burst = [ zeros(1,1) ones(1,W) ]; for n = 2:PulsesPerBurst I = [ I ones(1,W+2) zeros(1,PulseGap-2) ]; Q = [ Q ones(1,W+2) zeros(1,PulseGap-2) ]; Burst = [ Burst ones(1,PulseGap+W) ]; if n == PulsesPerBurst RFgateFlag = [ RFgateFlag ones(1,W) zeros(1,PulseGap-1) ]; else RFgateFlag = [ RFgateFlag ones(1,W) zeros(1,PulseGap) ]; end end Marker1 = [ Burst zeros(1,PulseGap-1) ]; % Burst Marker2 = RFgateFlag; % Pulse Marker3 = RFgateFlag; % Pulse data = [I' Q' Marker1' Marker2' Marker3' RFgateFlag']; csvwrite(CSVfile,data); BurstGapPulseLength = PRF*BurstPeriod-PulsesPerBurst; zero = zeros(1,Fs/PRF); % samples/pulse zerodata = [zero' zero' zero' zero' zero' zero']; csvwrite(zerofile,zerodata); zerofileMultiple = PRF*BurstPeriod-PulsesPerBurst % Pulse length in Burst gap
RF gate flag
I/Q (DC)
MG3700A-E-F-11
Slide 28
14
Pulse Modulation
Programming Example
Sequence feature technique
Repeat
MG3700A-E-F-11
Slide 29
Pulse Modulation
Programming Example
Create a sequence file
Element 1
Element 2
Repeat
MG3700A-E-F-11
Slide 30
15
I = x(t) = Q = y(t) =
t Ac cos D f m( )d t Ac sin D f m( )d
Ac: Carrier signal amplitude = 1 PRF: 2000 [pps] Pulse width: 20 [s] Pulses/burst: 20
clear all, close all, clc PW = 20; % Pulse Width [us] PRF = 2000; % [pps] Fpeak = 2.5; % Peak Frequency Deviation [MHz] CSVfile = 'RTS6W20us2000pps.csv' zerofile ='RTS6W20us2000ppsZero.csv' Fs = Fpeak * 40 DataPoints = PW * Fs; % Sampling rate [MHz]
MG3700A-E-F-11
Slide 31
MG3700A-E-F-11
Slide 32
16
Command Window
Repeat
Repeat
MG3700A-E-F-11
Slide 33
Repeat
Repeat
MG3700A-E-F-11
Slide 34
17
PSK, QAM
Digital modulation schemes change the amplitude, frequency and phase of the carrier at regular time intervals, and sends a digital baseband signal.
Analog modulation schemes change the carrier amplitude, frequency and phase continuously. Basic digital modulation schemes: Amplitude Shift Keying (ASK)
The amplitude of the carrier varies linearly with the symbol sequence.
1 0 1
MG3700A-E-F-11
Slide 35
PSK, QAM
This chapter shows common examples for QPSK, /4DQPSK, 8PSK, 16QAM.
Q Ac 00
QPSK
10
/4DQPSK
Q Ac 00 01 11 10 Ac I
-Ac
Ac
-Ac
8PSK
11 -Ac Q 01 011 Ac 010 001 -Ac 1000
16QAM
Q 1010 3Ac 1011 Ac -3Ac 1101 -Ac Ac 0111 3Ac 0101 I 0010 0000
0011
0001
101
-Ac 110
111 1100
1110
0110
0100
MG3700A-E-F-11
Slide 36
18
QPSK
Complex envelop g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)
clear all, close all, clc
MATLAB requires: Signal Processing Toolbox Communications Toolbox
Fd = 1; % Symbol rate [sps] Fs = 10*Fd;% Oversampling rate Pd = 256; % Symbol points repetition = 2; % Repetition factor of data R = 0.5; % Rolloff factor for FIR filter delay = 3; % Filter's group delay CSVfile='QPSK.csv' M = 4; % Point signal constellations SymbolData = randint(Pd,1,M); % Random data [Communications Toolbox] % Duplicate the symbol data because of waveform phase continuity DuplicateSymbolData = repmat(SymbolData,repetition,1); % Replicate the symbol data [Fixed-Point Toolbox] g = pskmod(DuplicateSymbolData,M,pi/4); % Complex envelop g(t), Initial phase pi/4 rad [Communications Toolbox] (Continued on the next page)
MG3700A-E-F-11
Slide 37
QPSK
(Continued from previous page) filtering = rcosflt(g,Fd,Fs,'fir/normal',R,delay); % Filter input signal using FIR filter [Communications Toolbox] OversampledData = filtering(Fs*delay*2+1:Fs*delay*2+Fs*Pd); % Correct filter delay data = [real(OversampledData) imag(OversampledData)]; % I/Q data csvwrite(CSVfile,data); scatterplot(OversampledData,1,0,'b-'),hold on,plot(g,'r*'),grid % Signal constellation
figure % Complex envelop t_g = 0:Pd*repetition-1; % g(t) symbol number t_o = delay:Fd/Fs:delay+Pd-1/Fs; % Oversampled symbol number subplot(2,1,1),stem(t_g,real(g),'r*'),hold on,plot(t_o,real(OversampledData)),grid% In-phase axis([-1 Pd*repetition+1 round(min(real(g))) round(max(real(g)))]) title('I signal'),xlabel('Symbol'),ylabel('Amplitude') subplot(2,1,2),stem(t_g,imag(g),'r*'),hold on,plot(t_o,imag(OversampledData)),grid % Quadrature-phase axis([-1 Pd*repetition+1 round(min(imag(g))) round(max(imag(g)))]) title('Q signal'),xlabel('Symbol'),ylabel('Amplitude')
MG3700A-E-F-11
Slide 38
19
Waveform length
MG3700A-E-F-11
Slide 39
/4DQPSK
Complex envelop g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)
clear all, close all, clc
MATLAB requires: Signal Processing Toolbox Communications Toolbox
Fd = 1; % Symbol rate [sps] Fs = 10*Fd;% Oversampling rate Pd = 256; % Symbol points repetition = 2; % Repetition factor of data R = 0.5; % Rolloff factor for FIR filter delay = 3; % Filter's group delay CSVfile='pi4DQPSK.csv' M = 4; % Point signal constellations SymbolData = randint(Pd,1,M); % Random data [Communications Toolbox] % Duplicate the symbol data because of waveform phase continuity DuplicateSymbolData = repmat(SymbolData,repetition,1); % Replicate the symbol data [Fixed-Point Toolbox] g = dpskmod(DuplicateSymbolData,M,pi/4); % Complex envelop g(t) using phase shift pi/4 rad [Communications Toolbox] (Continued on the next page)
MG3700A-E-F-11
Slide 40
20
/4DQPSK
(Continued from previous page) filtering = rcosflt(g,Fd,Fs,'fir/normal',R,delay); % Filter input signal using FIR filter [Communications Toolbox] OversampledData = filtering(Fs*delay*2+1:Fs*delay*2+Fs*Pd); % Correct filter delay data = [real(OversampledData) imag(OversampledData)]; % I/Q data csvwrite(CSVfile,data); scatterplot(OversampledData,1,0,'b-'),hold on,plot(g,'r*'),grid % Signal constellation
figure % Complex envelop t_g = 0:Pd*repetition-1; % g(t) symbol number t_o = delay:Fd/Fs:delay+Pd-1/Fs; % Oversampled symbol number subplot(2,1,1),stem(t_g,real(g),'r*'),hold on,plot(t_o,real(OversampledData)),grid% In-phase axis([-1 Pd*repetition+1 min(real(OversampledData)) max(real(OversampledData))]) title('I signal'),xlabel('Symbol'),ylabel('Amplitude') subplot(2,1,2),stem(t_g,imag(g),'r*'),hold on,plot(t_o,imag(OversampledData)),grid % Quadrature-phase axis([-1 Pd*repetition+1 min(imag(OversampledData)) max(imag(OversampledData))]) title('Q signal'),xlabel('Symbol'),ylabel('Amplitude')
MG3700A-E-F-11
Slide 41
8PSK
Complex envelop g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)
clear all, close all, clc
MATLAB requires: Signal Processing Toolbox Communications Toolbox
Fd = 1; % Symbol rate [sps] Fs = 10*Fd;% Oversampling rate Pd = 256; % Symbol points repetition = 2; % Repetition factor of data R = 0.5; % Rolloff factor for FIR filter delay = 3; % Filter's group delay CSVfile='8PSK.csv' M = 8; % Point signal constellations SymbolData = randint(Pd,1,M); % Random data [Communications Toolbox] % Duplicate the symbol data because of waveform phase continuity DuplicateSymbolData = repmat(SymbolData,repetition,1); % Replicate the symbol data [Fixed-Point Toolbox] g = pskmod(DuplicateSymbolData,M); % Complex envelop g(t) [Communications Toolbox] (Continued on the next page)
MG3700A-E-F-11
Slide 42
21
8PSK
(Continued from previous page) filtering = rcosflt(g,Fd,Fs,'fir/normal',R,delay); % Filter input signal using FIR filter [Communications Toolbox] OversampledData = filtering(Fs*delay*2+1:Fs*delay*2+Fs*Pd); % Correct filter delay data = [real(OversampledData) imag(OversampledData)]; % I/Q data csvwrite(CSVfile,data); scatterplot(OversampledData,1,0,'b-'),hold on,plot(g,'r*'),grid % Signal constellation
figure % Complex envelop t_g = 0:Pd*repetition-1; % g(t) symbol number t_o = delay:Fd/Fs:delay+Pd-1/Fs; % Oversampled symbol number subplot(2,1,1),stem(t_g,real(g),'r*'),hold on,plot(t_o,real(OversampledData)),grid% In-phase axis([-1 Pd*repetition+1 min(real(OversampledData)) max(real(OversampledData))]) title('I signal'),xlabel('Symbol'),ylabel('Amplitude') subplot(2,1,2),stem(t_g,imag(g),'r*'),hold on,plot(t_o,imag(OversampledData)),grid % Quadrature-phase axis([-1 Pd*repetition+1 min(imag(OversampledData)) max(imag(OversampledData))]) title('Q signal'),xlabel('Symbol'),ylabel('Amplitude')
MG3700A-E-F-11
Slide 43
16QAM
Complex envelop g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)
clear all, close all, clc
MATLAB requires: Signal Processing Toolbox Communications Toolbox
Fd = 1; % Symbol rate [sps] Fs = 10*Fd;% Oversampling rate Pd = 256; % Symbol points repetition = 2; % Repetition factor of data R = 0.5; % Rolloff factor for FIR filter delay = 3; % Filter's group delay CSVfile='16QAM.csv' M = 16; % Point signal constellations SymbolData = randint(Pd,1,M); % Random data [Communications Toolbox] % Duplicate the symbol data because of waveform phase continuity DuplicateSymbolData = repmat(SymbolData,repetition,1); % Replicate the symbol data [Fixed-Point Toolbox] g = pskmod(DuplicateSymbolData,M); % Complex envelop g(t) [Communications Toolbox] (Continued on the next page)
MG3700A-E-F-11
Slide 44
22
16QAM
(Continued from previous page) filtering = rcosflt(g,Fd,Fs,'fir/normal',R,delay); % Filter input signal using FIR filter [Communications Toolbox] OversampledData = filtering(Fs*delay*2+1:Fs*delay*2+Fs*Pd); % Correct filter delay data = [real(OversampledData) imag(OversampledData)]; % I/Q data csvwrite(CSVfile,data); scatterplot(OversampledData,1,0,'b-'),hold on,plot(g,'r*'),grid % Signal constellation
figure % Complex envelop t_g = 0:Pd*repetition-1; % g(t) symbol number t_o = delay:Fd/Fs:delay+Pd-1/Fs; % Oversampled symbol number subplot(2,1,1),stem(t_g,real(g),'r*'),hold on,plot(t_o,real(OversampledData)),grid% In-phase axis([-1 Pd*repetition+1 min(real(OversampledData)) max(real(OversampledData))]) title('I signal'),xlabel('Symbol'),ylabel('Amplitude') subplot(2,1,2),stem(t_g,imag(g),'r*'),hold on,plot(t_o,imag(OversampledData)),grid % Quadrature-phase axis([-1 Pd*repetition+1 min(imag(OversampledData)) max(imag(OversampledData))]) title('Q signal'),xlabel('Symbol'),ylabel('Amplitude')
MG3700A-E-F-11
Slide 45
Simulink
What is Simulink?
Simulink is a software package for modeling, simulating, and analyzing dynamic systems. It supports linear and nonlinear systems, modeled in continuous time, sampled time, or a hybrid of the two.
MG3700A-E-F-11
Slide 46
23
Simulink Demos
Simulink demos illustrate useful modeling concepts. Access demos from the MATLAB Command Window.
MG3700A-E-F-11
Slide 47
Model of physical layer of IEEE 802.11a Wireless LAN standard, including adaptive modulation, using blocks in Communications Blockset.
MG3700A-E-F-11
Slide 48
24
Blocks
MG3700A-E-F-11
Slide 49
Complex to Real-Imag
I Q
MG3700A-E-F-11
Slide 50
25
Complex to Real-Imag
Parameters
Output
This parameter determines the output of this block. Choose from the following values: Real and imag (outputs the input signal's real and imaginary parts), Real (outputs the input's real part), Imag (outputs the input's imaginary part).
MG3700A-E-F-11
Slide 51
To Workspace
Write data to workspace
The To Workspace block writes its input to the workspace. The block writes its output to an array or structure with the name specified by the block's Variable name parameter. The Save format parameter determines the output format.
I or Q
Array
MG3700A-E-F-11
Slide 52
26
To Workspace
Array
Selecting this option causes the To Workspace block to save the input as an Ndimensional array where N is one more than the number of dimensions of the input signal. For example, if the input signal is a 1-D array (i.e., a vector), the resulting workspace array is two-dimensional. If the input signal is a 2-D array (i.e., a matrix), the array is three-dimensional. The way samples are stored in the array depends on whether the input signal is a scalar or vector or a matrix. If the input is a scalar or a vector, each input sample is output as a row of the array. For example, suppose that the name of the output array is simout. Then, simout(1,:) corresponds to the first sample, simout(2,:) corresponds to the second sample, etc. If the input signal is a matrix, the third dimension of the workspace array corresponds to the values of the input signal at the specified sampling point. For example, suppose again that simout is the name of the resulting workspace array. Then, simout(:,:,1) is the value of the input signal at the first sample point; simout(:,:,2) is the value of the input signal at the second sample point; etc. Block parameters control when and how much data the To Workspace block writes: 1. The Limit data points to last parameter indicates how many sample points to save. If the simulation generates more data points than the specified maximum, the simulation saves only the most recently generated samples. To capture all the data, set this value to inf. 2. The Decimation parameter allows you to write data at every nth sample, where n is the decimation factor. The default decimation, 1, writes data at every time step. 3. The Sample time parameter allows you to specify a sampling interval at which to collect points. This parameter is useful when you are using a variable-step solver where the interval between time steps might not be the same. The default value of -1 causes the block to inherit the sample time from the driving block when determining the points to write.
MG3700A-E-F-11
Slide 53
To Workspace
For variable-step solvers, the Output options found on the Data Import/Export pane of the Configuration Parameters dialog box determine the original amount of data available to the To Workspace block. For example, to ensure that data is written at identical time points over multiple simulations, select the Produce specified output only option in the Configuration Parameters dialog box and enter the desired time vector. The To Workspace block begins with this specified time vector and further limits the amount of data written to the workspace based on its block parameters. During the simulation, the block writes data to an internal buffer. When the simulation is completed or paused, that data is written to the workspace. Its icon shows the name of the array to which the data is written.
MG3700A-E-F-11
Slide 54
27
To Workspace
Parameters
Variable name
Name of array holding data
Decimation
Decimation factor (The default is 1.)
Sample time
Sample time at which to collect points
Save format
Format in which to save simulation output to workspace (The default is structure.)
MG3700A-E-F-11
Slide 55
The model plots the output of the DQPSK Modulator Baseband block. The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol.
I Q
Running the model produces the plot. The plot reflects the transitions among the eight DQPSK constellation points. This plot illustrates /4DQPSK modulation, because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi/4.
MG3700A-E-F-11
Slide 56
28
I or Q
Array
MG3700A-E-F-11
Slide 57
Note
When the MG3700A generates this I/Q signal, a raised cosine FIR filter block must be added to the model.
For more information about the raised cosine FIR filter block
http://www.mathworks.com/access/helpdesk/help/toolbox/commblks/ref/raisedcosinetransmit filter.html Upsample and filter input signal using raised cosine FIR filter
MG3700A-E-F-11
Slide 58
29
Running the model produces the plot. The plot reflects the channel's effect on the QPSK constellation points.
MG3700A-E-F-11
Slide 59
MG3700A-E-F-11
Slide 60
30
Array
Trajectory
MG3700A-E-F-11
Slide 61
IEEE 802.11a/g WLAN OFDM physical layer model demonstrating adaptive modulation and coding
Requirements: Communications Toolbox, Communications Blockset, Signal Processing Blockset, Signal Processing Toolbox End-to-end 802.11a physical layer All mandatory and optional data rates: 6, 9, 12, 18, 24, 36, 48, and 54 Mb/s BPSK, QPSK, 16QAM, 64QAM modulations Forward error correction coding (convolutional; code rates 1/2, 2/3, 3/4) OFDM transmission: 52 subcarriers, 4 pilots, 64-pt FFTs, CP (Cyclic Prefix) Data interleaving PLCP preamble (modeled as 2x2 long training sequences) Receiver equalization Viterbi decoding Data rates selectable on-the-fly Adaptive modulation demo over dispersive multipath fading channel
MG3700A-E-F-11
Slide 62
31
Signal Visualization
SNR
Bit rate
Running the model and double-clicking Signal Visualization block produce the plot.
MG3700A-E-F-11
Slide 63
MG3700A-E-F-11
Slide 64
32
MG3700A-E-F-11
Slide 65
Array
Convert in IQproducer
MG3700A-E-F-11
Slide 66
33
MG3700A-E-F-11
Slide 67
Programming Example to Convert and Transfer I/Q Data File without IQproducer
To download IQ data to the MG3700A, typically, it is easier to use "Convert" and "Transfer & Setting" in IQproducer, because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file. This process takes more time because a text file is larger, and it is a bother. To minimize the time to convert a IQ data file, create a specific binary data file. This section examines how to facilitate downloading a complex data array from within the MATLAB environment.
1. Creating GUI with GUIDE 2. Executing [Convert] 3. Executing [Transfer] and [Play]
MG3700A-E-F-11
Slide 68
34
GUI Programming
GUIDE automatically generates an M-file controlling how the GUI operates. This M-file provides code to initialize the GUI and contains a framework for the GUI callbacks -- the routines that execute when a user interacts with a GUI component. Using the M-file editor, add code to the callbacks to perform the required functions.
FIG-file
MG3700A-E-F-11
Slide 69
Executing [Convert]
Programming Flowchart
Input strings Create parameter file for converting Files Parameter text file for converting
MG3700A-E-F-11
Slide 70
35
Check existing package folder or make new package folder in MG3700A HDD
[Play]: Load pattern data to baseband memory with TCP/IP remote control
Create TCP/IP object
MG3700A-E-F-11
Slide 71
FIG-file
M-file function function varargout = convandtranstool(varargin) % CONVANDTRANSTOOL M-file for convandtranstool.fig % CONVANDTRANSTOOL, by itself, creates a new CONVANDTRANSTOOL or raises the existing % singleton*. % % H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to % the existing singleton*. % % CONVANDTRANSTOOL('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in CONVANDTRANSTOOL.M with the given input arguments. % % CONVANDTRANSTOOL('Property','Value',...) creates a new CONVANDTRANSTOOL or raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before convandtranstool_OpeningFunction gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to convandtranstool_OpeningFcn via varargin. % % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one % instance to run (singleton)". % % See also: GUIDE, GUIDATA, GUIHANDLES % Edit the above text to modify the response to help convandtranstool
M-file
Mi
MG3700A-E-F-11
Slide 72
36
% I/Q data
RMSvalue = sqrt(sum(I_Q(:,1).^2 + I_Q(:,2).^2)/(2*length(I_Q))); I_Q = round(I_Q*1634/RMSvalue); % To integer Convert decimal fraction to 16-bit integer marker1 = [ ones(10,1) ; zeros(length(I_Q)-10,1) ]; marker2 = zeros(length(I_Q),1); marker3 = zeros(length(I_Q),1); gate = ones(length(I_Q),1); % RF gate flag marker_gate = marker3*2^10 + marker2*2^9 + marker1*2^8 + gate*2^0; data = [I_Q marker_gate]; convandtranstool
Call M-file function
MG3700A-E-F-11
Slide 73
MG3700A-E-F-11
Slide 74
37
MG3700A-E-F-11
Slide 75
MG3700A-E-F-11
Slide 76
38
MG3700A-E-F-11
Slide 77
Function reference
Syntax
MakeWvFile "ParameterFilename" "DataFilename"
Arguments
"ParameterFilename" "DataFilename"
Command Prompt
Text filename for file header (.wvi) Specific binary data filename for data file (.wvd)
MG3700A-E-F-11
Slide 78
39
MX2690
For MS2690A-20 (VSG option) If the parameter is blank, MX3700 is set.
Package
Folder name for pattern file
30 characters
If the parameter is blank, Convert_IQproducer is set.
Pattern Name
20 characters
Sampling Rate
Number of I/Q waveform samples per second (expressed in Hz and equal to reciprocal of sampling interval)
20000 to 160000000Hz (20 kHz to 160 MHz)
Resolution 0.001 Hz
Over Sampling
Oversampling ratio (OSR): Ratio of sampling rate to modulation rate
1 to 999
If the parameter is blank, 1 is set.
MG3700A-E-F-11
Slide 79
Frame Length
Frame sample length
1 to 8388607
If the parameter is blank, Input Frame Trigger cannot be used.
RMS I / Q =
(I
n =1
2
n
+ Qn )
2N
MG3700A-E-F-11
Slide 80
40
MG3700A-E-F-11
Slide 81
[RF Gate]
Rf On Off Threshold
Threshold level for automatic detection of no signal and active/inactive (On/Off) definition of RF gate flag
0 to 100%
100% reference level: Peak I n + Qn If the parameter is blank, RF gate flag is not changed.
2 2
MG3700A-E-F-11
Slide 82
41
RF Gate Parameters
Blue line
Peak level (+12.9892 dB)
Red line
Rf On Off Threshold 1% (-40 dB) Min Rf Gate Length 100 samples
MG3700A-E-F-11
Slide 83
Q 2 bytes
MG3700A-E-F-11
Slide 84
42
32767 01111111 11111111 : 1 00000000 00000001 0 00000000 00000000 -1 11111111 11111111 : -32768 10000000 00000000
60 F6 2A 00 01 01
I Q
Gate Markers
[HEX] [Decimal]
5B F6
-2469
257
-2464
42
257
F6 60 00 2A 01 01
I Q
Markers Gate
[HEX]
F6 5B
Markers Gate
MG3700A-E-F-11
Slide 85
Byte Order
The little endian or big endian byte order depends on the type of PC processor.
Intel and AMD processors use little endian. Sun and Motorola processors use big endian. The Apple PowerPC processor, while big endian oriented, also supports the little endian order.
Always refer to the processor manufacturer to determine the order they use for bytes and, if they support both, to understand how to ensure that you are using the correct byte order.
The byte order describes how the system processor stores integer values as binary data in memory.
When outputting data from a little endian system to a text file (ASCII text), the values are the same as viewed from a big endian system. The order only becomes important when using binary data, as when downloading data to MG3700A.
MG3700A-E-F-11
Slide 86
43
Byte Order
The LSB and MSB positioning changes with byte order. In little endian order, the LSB and MSB are next to each other in the bit sequence.
Example of -2469 signed integer Little endian
5B F6 [HEX]
LSB MSB
01011011
MSB
11110110
LSB
[Binary]
Big endian
F6 5B [HEX]
11110110
01011011
[Binary]
Most Significant Bit (MSB) is bit position in binary number with greatest value. Least Significant Bit (LSB) is bit position in binary integer determining whether the number is even or odd.
In 2-byte data, the MSB appears in the second byte.
MG3700A-E-F-11
Slide 87
The decimal value of a two's complement binary number is calculated by taking the value of the MSB, where the value is negative when the bit is one, and adding the values for each power of two where there is a one.
F6 5B: 11110110 01011011 = -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569
MG3700A-E-F-11
Slide 88
44
MG3700A-E-F-11
Slide 89
MakeWvFile Error
An error code is returned when an error occurs. Error code
0
successful completion
16
File writing failure
23
Converting failure due to irregular Pattern Name in parameter text file
24
Converting failure due to irregular Package name in parameter text file
25
Converting failure due to irregular Sampling Rate in parameter text file
64
WVD file opening failure
65
WVI file opening failure
66
Data binary file opening failure
67
Parameter text file opening failure
MG3700A-E-F-11
Slide 90
45
MG3700A-E-F-11
Slide 91
MG3700A-E-F-11
Slide 92
46
Play
Programming Example
% --- Executes on button press in pushbutton4. function pushbutton4_Callback(hObject, eventdata, handles) % hObject handle to pushbutton4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA)
MG3700A-E-F-11
Slide 93
Play
Programming Example
package = get(handles.edit9, 'String'); patname = get(handles.edit2, 'String'); if isempty(package) package = 'Convert_IQproducer'; end fprintf(t, ['LDFILE WMA,"' package '", "' patname '"']); for n = 1:150 pause(1); fprintf(t, 'ESR2?'); flag = str2num(fscanf(t)); if bitget(flag, 5) == 1 break; end end
Monitor END Event Status Register Get input strings
fclose(t); delete(t);
MG3700A-E-F-11
Slide 94
47
convandtranstool.m
M-file function called from within Anritsu_SG_demo.m
convandtranstool.fig
GUI layout saved by GUIDE
MakeWvFile.exe
Executable file to convert a data file into Anritsu VSG format
MG37WP06.dll
DLL file called from within MakeWvFile.exe
MG3700A-E-F-11
Slide 95
48
Anritsu Corporation
5-1-1 Onna, Atsugi-shi, Kanagawa, 243-8555 Japan Phone: +81-46-223-1111 Fax: +81-46-296-1264
Italy
Anritsu S.p.A.
India
U.S.A.
Via Elio Vittorini 129, 00144 Roma, Italy Phone: +39-6-509-9711 Fax: +39-6-502-2425
Anritsu Company
Sweden Finland
1155 East Collins Blvd., Suite 100, Richardson, TX 75081, U.S.A. Toll Free: 1-800-267-4878 Phone: +1- 972-644-1777 Fax: +1-972-671-1877
Anritsu AB
Unit No. S-3, Second Floor, Esteem Red Cross Bhavan, No. 26, Race Course Road, Bangalore 560 001, India Phone: +91-80-32944707 Fax: +91-80-22356648
Canada
Anritsu AB
700 Silver Seven Road, Suite 120, Kanata, Ontario K2V 1C3, Canada Phone: +1-613-591-2003 Fax: +1-613-591-1006
Units 4 & 5, 28th Floor, Greenfield Tower, Concordia Plaza, No. 1 Science Museum Road, Tsim Sha Tsui East, Kowloon, Hong Kong Phone: +852-2301-4980 Fax: +852-2301-3545
Denmark Spain
Brazil
Anritsu A/S
Praca Amadeu Amaral, 27 - 1 Andar 01327-010-Paraiso-So Paulo-Brazil Phone: +55-11-3283-2511 Fax: +55-11-3288-6940
Kirkebjerg All 90, DK-2605 Brndby, Denmark Phone: +45-72112200 Fax: +45-72112210
Mexico
Room 1515, Beijing Fortune Building, No. 5, Dong-San-Huan Bei Road, Chao-Yang District, Beijing 10004, P.R. China Phone: +86-10-6590-9230 Fax: +86-10-6590-9235
Korea
Av. Ejrcito Nacional No. 579 Piso 9, Col. Granada 11520 Mxico, D.F., Mxico Phone: +52-55-1101-2370 Fax: +52-55-5254-3147
8F Hyunjuk Building, 832-41, Yeoksam Dong, Kangnam-ku, Seoul, 135-080, Korea Phone: +82-2-553-6603 Fax: +82-2-553-6604
U.K.
Australia
200 Capability Green, Luton, Bedfordshire, LU1 3LU, U.K. Phone: +44-1582-433200 Fax: +44-1582-731303
France
Anritsu S.A.
P O Box 500413 - Dubai Internet City Al Thuraya Building, Tower 1, Suit 701, 7th Floor Dubai, United Arab Emirates Phone: +971-4-3670352 Fax: +971-4-3688460
Unit 21/270 Ferntree Gully Road, Notting Hill, Victoria 3168, Australia Phone: +61-3-9558-8177 Fax: +61-3-9558-8255
Taiwan
16/18 avenue du Qubec-SILIC 720 91961 COURTABOEUF CEDEX, France Phone: +33-1-60-92-15-50 Fax: +33-1-64-46-10-65
Singapore
Germany
Anritsu GmbH
60 Alexandra Terrace, #02-08, The Comtech (Lobby A) Singapore 118502 Phone: +65-6282-2400 Fax: +65-6282-2533
7F, No. 316, Sec. 1, Neihu Rd., Taipei 114, Taiwan Phone: +886-2-8751-1816 Fax: +886-2-8751-1817
Nemetschek Haus, Konrad-Zuse-Platz 1 81829 Mnchen, Germany Phone: +49-89-442308-0 Fax: +49-89-442308-55
Please Contact:
071001
No. MG3700A-E-F-11-(3.00)
Printed in Japan
2008-1
AKD