Top Banner
Application Note MATLAB Application MG3700A Vector Signal Generator
50

Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

Aug 24, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

Application Note

MATLAB Application

MG3700A Vector Signal Generator

1

Slide 1MG3700A-E-F-11

Application Note- Application -

Anritsu

January 2008(300)

Slide 2MG3700A-E-F-11

Contents

bull Introduction 3bull Modulation Basics 5bull Understanding Signal Pattern File 10bull Programming Examples to Create IQ Data File

18raquo Analog Modulation 19raquo Pulse Modulation 26raquo PSK QAM 35raquo Simulink 46

bull Programming Example to Convert and Transfer IQ Data File without IQproducer 68

2

Slide 3MG3700A-E-F-11

Introduction

bull Electronic Design Automation (EDA) tools such as MATLAB and Microwave Office can save IQ simulation data to CSV text files

raquo Easy comparison between simulation and measured databull The IQproducer application software (MG3700A standard accessory)

can import user IQ sample data from CSV files into MG3700A making it useful for various applications

raquo RampD into next-generation wireless systems RFID PWM analog modulation such as AM FM and PM

Creating CSV filesof baseband signals

Processing (Simulating)signals using C program orEDA tools such as MATLAB

Converting to signalpattern files for MG3700A

FTP

User-specificSoftware

Slide 4MG3700A-E-F-11

Introduction

bull MG3700A supports Arbitrary Waveform Generator (AWG) featuresraquo Sample rate (Fs)

ndash 20 k to 160 MHzraquo Waveform memory

ndash 2times 128 Msamplechannel (1 GB)ndash 2times 256 Msamplechannel (2 GB) with Option Memory upgrade

bull Dual baseband memoryraquo DAC resolution

ndash 14 bitsraquo Marker output

ndash 3 definable TTL

bull This document presents MATLAB usage examples

3

Slide 5MG3700A-E-F-11

Modulation Basics

bull Modulation imposes source data on a passband signal with carrier frequency ƒc by using amplitude andor phase perturbations

Signal processor Carrier circuitsData Modulated signal

Modulating signalm(t)

Baseband signalg(t)

Passband signals(t)Baseband circuits RF circuits

fm-fm

Amplitude

fc+fmfc-fm fc0 f

Basebandbandwidth

Passbandbandwidth

Slide 6MG3700A-E-F-11

Modulation Transmitter

bull AM-PMtechnique

bull Quadrature (IQ)technique

Baseband signalprocessor ƒc

m(t)

R(t) v(t)=R(t) cos[ωct+θ(t)]

Baseband circuits RF circuits

sum

θ(t)φM cos[ωct+θ(t)]

ωc=2πƒc

Baseband signalprocessor

ƒcm(t)

x(t)

v(t)=x(t) cos(ωct) - y(t) sin(ωct)

Baseband circuits RF circuits

y(t)

-π2 shift

+

-

cos(ωct)

cos(ωct)

sin(ωct)

Equivalent

)()()( 22 tytxtR +=

x(t)=R(t) cosθ(t)y(t)=R(t) sinθ(t)

I

Q

4

Slide 7MG3700A-E-F-11

Baseband Waveform

Dp Phase deviation [radV]Acsin[Dpm(t)]Accos[Dpm(t)]Dpm(t)AcPM

m1(t) = plusmn1m2(t) = plusmn1

Dƒ Frequency deviation [radVmiddots]

m(t)=micro sin(2πƒmt)micro Modulation depthƒm Modulation freq

Remark

Acm2(t)Acm1(t)QM

AcFM

0Ac[1+m(t)]0Ac[1+m(t)]AM

y(t)x(t)θ(t)R(t)Modulationscheme

IQ modulationAM-PM

int infinminus

t

f dmD σσ )(

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

)()( 22

21 tmtmAc + )(

)(tan1

21

tmtmminus

QM Quadrature Modulation

Slide 8MG3700A-E-F-11

Baseband Signal

bull Any type of modulated signal may be generated using either the AM-PM technique or quadrature technique

bull Any modulation scheme can be achieved by selecting the appropriate software algorithm

bull 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

bull In digital computer simulations of passband signals the sampling rate used in the simulation can be minimized by working with thebaseband signal instead of with the passband signal s(t) because the baseband signal is equivalent of the passband signal

5

Slide 9MG3700A-E-F-11

bull CW

bull FM

bull AM

bull PSK

Fundamental IQ Constellation

I

Q

I

Q

Magnitude R(t)

I

Q

I

QPhase shiftπ2 [rad]

Ac

Ac-Ac

-Ac

Ac

Angular velocity[rads]

Ac

Ac

Ac

Ac

Slide 10MG3700A-E-F-11

Understanding Signal Pattern File

bull Signal pattern files consist of three dataraquo IQ dataraquo Marker dataraquo File header

User-created IQ dataand Marker data

wvdBinary file

wviText file

FTP

CF

FTP connection

HDD

Text file to binary fileLarge ltltlt File size gtgtgt Small

File header

IQ data scaled to DAC input values Download rarr

larr Extract

6

Slide 11MG3700A-E-F-11

IQ Data

bull The data file (wvd) contains the I and Q data points (signed 14-bit integers for each I and Q data point) Each IQ point equals onebaseband waveform point

bull 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

IQ data range DAC range IQ output voltagendash 8191 ----------------- 16383 ----------------- Vmax Positive (+) full scalendash 0 ----------------- 8191 ----------------- 0 Vndash -8192 ----------------- 0 ----------------- Vmin Negative (-) full scale

DACI data LPF

DACQ data LPF Q

I

Slide 12MG3700A-E-F-11

IQ Data Range

bull The MG3700A performance is guaranteed within IQ DAC RMS value 1157 to 1634

raquo Tunable DAC RMS value considered crest factor (peak powerRMS power)

raquo Tunable RMS power on MG3700A display

Q

+8191

+8191

-8191

-8191

+1634

+1157

0

11 dB

3 dB

210 8191log202778 asympdB

22 QI +

2210 16341634log202867 +asympdB

2210 11571157log202864 +asympdB

I

22 QI +

+1157 +1634

Margin for crest factor

7

Slide 13MG3700A-E-F-11

Marker Data

bull The marker data uses 4 bits per IQ data point to set the state of the four markers either On (1) or Off (0) for each IQ data point

bull The marker data consists of three event markers and an RF gate flag

bull 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

bull An RF gate flag is used for pulse modulation and drives the internal pulse modulator

raquo When IQ data is imported without marker data event markers are set automatically to inactive (Off) and the RF gate flag is set to active (On)

Slide 14MG3700A-E-F-11

Internal Pulse Modulator

Burst power

If the RF gate flag is not used carrier leakage occurs

Specification le -40 dBc

RF Gate flag

1

0

If the RF gate flag is used the RF output is off

Specification le -60 dBc (OnOff ratio gt 60 dB)

Power at IQ = 0

IQModulator

PulseModulatorBaseband

Generator

DelayAdjustment

RF

RF Gate

I

Q

Power at RF gate flag Off

8

Slide 15MG3700A-E-F-11

Timing

bull Because markers are set at each IQ data point the marker data contains the same number of samples as IQ data points

bull The time difference between the event markers output connector and RF connector is adjusted to be within plusmn1 sample

IQModulator

PulseModulator

BasebandGenerator

DelayAdjustment

RF

RF Gate

Marker 1Marker 2Marker 3

IQ1 IQ2 IQ3 hellip

hellip

IQ4

Gate1(1) Gate2(0) Gate3(1) Gate4(1) hellip

RFI

Q

Slide 16MG3700A-E-F-11

File Header

bull The data file (wvd) and file header (wvi) have the same file name The MG3700A stores the files in same package folder

bull The file header contains settings for the ARB modulation formatsuch as sample rate number of samples IQ DAC RMS value etc

raquo 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

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 2: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

1

Slide 1MG3700A-E-F-11

Application Note- Application -

Anritsu

January 2008(300)

Slide 2MG3700A-E-F-11

Contents

bull Introduction 3bull Modulation Basics 5bull Understanding Signal Pattern File 10bull Programming Examples to Create IQ Data File

18raquo Analog Modulation 19raquo Pulse Modulation 26raquo PSK QAM 35raquo Simulink 46

bull Programming Example to Convert and Transfer IQ Data File without IQproducer 68

2

Slide 3MG3700A-E-F-11

Introduction

bull Electronic Design Automation (EDA) tools such as MATLAB and Microwave Office can save IQ simulation data to CSV text files

raquo Easy comparison between simulation and measured databull The IQproducer application software (MG3700A standard accessory)

can import user IQ sample data from CSV files into MG3700A making it useful for various applications

raquo RampD into next-generation wireless systems RFID PWM analog modulation such as AM FM and PM

Creating CSV filesof baseband signals

Processing (Simulating)signals using C program orEDA tools such as MATLAB

Converting to signalpattern files for MG3700A

FTP

User-specificSoftware

Slide 4MG3700A-E-F-11

Introduction

bull MG3700A supports Arbitrary Waveform Generator (AWG) featuresraquo Sample rate (Fs)

ndash 20 k to 160 MHzraquo Waveform memory

ndash 2times 128 Msamplechannel (1 GB)ndash 2times 256 Msamplechannel (2 GB) with Option Memory upgrade

bull Dual baseband memoryraquo DAC resolution

ndash 14 bitsraquo Marker output

ndash 3 definable TTL

bull This document presents MATLAB usage examples

3

Slide 5MG3700A-E-F-11

Modulation Basics

bull Modulation imposes source data on a passband signal with carrier frequency ƒc by using amplitude andor phase perturbations

Signal processor Carrier circuitsData Modulated signal

Modulating signalm(t)

Baseband signalg(t)

Passband signals(t)Baseband circuits RF circuits

fm-fm

Amplitude

fc+fmfc-fm fc0 f

Basebandbandwidth

Passbandbandwidth

Slide 6MG3700A-E-F-11

Modulation Transmitter

bull AM-PMtechnique

bull Quadrature (IQ)technique

Baseband signalprocessor ƒc

m(t)

R(t) v(t)=R(t) cos[ωct+θ(t)]

Baseband circuits RF circuits

sum

θ(t)φM cos[ωct+θ(t)]

ωc=2πƒc

Baseband signalprocessor

ƒcm(t)

x(t)

v(t)=x(t) cos(ωct) - y(t) sin(ωct)

Baseband circuits RF circuits

y(t)

-π2 shift

+

-

cos(ωct)

cos(ωct)

sin(ωct)

Equivalent

)()()( 22 tytxtR +=

x(t)=R(t) cosθ(t)y(t)=R(t) sinθ(t)

I

Q

4

Slide 7MG3700A-E-F-11

Baseband Waveform

Dp Phase deviation [radV]Acsin[Dpm(t)]Accos[Dpm(t)]Dpm(t)AcPM

m1(t) = plusmn1m2(t) = plusmn1

Dƒ Frequency deviation [radVmiddots]

m(t)=micro sin(2πƒmt)micro Modulation depthƒm Modulation freq

Remark

Acm2(t)Acm1(t)QM

AcFM

0Ac[1+m(t)]0Ac[1+m(t)]AM

y(t)x(t)θ(t)R(t)Modulationscheme

IQ modulationAM-PM

int infinminus

t

f dmD σσ )(

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

)()( 22

21 tmtmAc + )(

)(tan1

21

tmtmminus

QM Quadrature Modulation

Slide 8MG3700A-E-F-11

Baseband Signal

bull Any type of modulated signal may be generated using either the AM-PM technique or quadrature technique

bull Any modulation scheme can be achieved by selecting the appropriate software algorithm

bull 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

bull In digital computer simulations of passband signals the sampling rate used in the simulation can be minimized by working with thebaseband signal instead of with the passband signal s(t) because the baseband signal is equivalent of the passband signal

5

Slide 9MG3700A-E-F-11

bull CW

bull FM

bull AM

bull PSK

Fundamental IQ Constellation

I

Q

I

Q

Magnitude R(t)

I

Q

I

QPhase shiftπ2 [rad]

Ac

Ac-Ac

-Ac

Ac

Angular velocity[rads]

Ac

Ac

Ac

Ac

Slide 10MG3700A-E-F-11

Understanding Signal Pattern File

bull Signal pattern files consist of three dataraquo IQ dataraquo Marker dataraquo File header

User-created IQ dataand Marker data

wvdBinary file

wviText file

FTP

CF

FTP connection

HDD

Text file to binary fileLarge ltltlt File size gtgtgt Small

File header

IQ data scaled to DAC input values Download rarr

larr Extract

6

Slide 11MG3700A-E-F-11

IQ Data

bull The data file (wvd) contains the I and Q data points (signed 14-bit integers for each I and Q data point) Each IQ point equals onebaseband waveform point

bull 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

IQ data range DAC range IQ output voltagendash 8191 ----------------- 16383 ----------------- Vmax Positive (+) full scalendash 0 ----------------- 8191 ----------------- 0 Vndash -8192 ----------------- 0 ----------------- Vmin Negative (-) full scale

DACI data LPF

DACQ data LPF Q

I

Slide 12MG3700A-E-F-11

IQ Data Range

bull The MG3700A performance is guaranteed within IQ DAC RMS value 1157 to 1634

raquo Tunable DAC RMS value considered crest factor (peak powerRMS power)

raquo Tunable RMS power on MG3700A display

Q

+8191

+8191

-8191

-8191

+1634

+1157

0

11 dB

3 dB

210 8191log202778 asympdB

22 QI +

2210 16341634log202867 +asympdB

2210 11571157log202864 +asympdB

I

22 QI +

+1157 +1634

Margin for crest factor

7

Slide 13MG3700A-E-F-11

Marker Data

bull The marker data uses 4 bits per IQ data point to set the state of the four markers either On (1) or Off (0) for each IQ data point

bull The marker data consists of three event markers and an RF gate flag

bull 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

bull An RF gate flag is used for pulse modulation and drives the internal pulse modulator

raquo When IQ data is imported without marker data event markers are set automatically to inactive (Off) and the RF gate flag is set to active (On)

Slide 14MG3700A-E-F-11

Internal Pulse Modulator

Burst power

If the RF gate flag is not used carrier leakage occurs

Specification le -40 dBc

RF Gate flag

1

0

If the RF gate flag is used the RF output is off

Specification le -60 dBc (OnOff ratio gt 60 dB)

Power at IQ = 0

IQModulator

PulseModulatorBaseband

Generator

DelayAdjustment

RF

RF Gate

I

Q

Power at RF gate flag Off

8

Slide 15MG3700A-E-F-11

Timing

bull Because markers are set at each IQ data point the marker data contains the same number of samples as IQ data points

bull The time difference between the event markers output connector and RF connector is adjusted to be within plusmn1 sample

IQModulator

PulseModulator

BasebandGenerator

DelayAdjustment

RF

RF Gate

Marker 1Marker 2Marker 3

IQ1 IQ2 IQ3 hellip

hellip

IQ4

Gate1(1) Gate2(0) Gate3(1) Gate4(1) hellip

RFI

Q

Slide 16MG3700A-E-F-11

File Header

bull The data file (wvd) and file header (wvi) have the same file name The MG3700A stores the files in same package folder

bull The file header contains settings for the ARB modulation formatsuch as sample rate number of samples IQ DAC RMS value etc

raquo 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

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 3: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

2

Slide 3MG3700A-E-F-11

Introduction

bull Electronic Design Automation (EDA) tools such as MATLAB and Microwave Office can save IQ simulation data to CSV text files

raquo Easy comparison between simulation and measured databull The IQproducer application software (MG3700A standard accessory)

can import user IQ sample data from CSV files into MG3700A making it useful for various applications

raquo RampD into next-generation wireless systems RFID PWM analog modulation such as AM FM and PM

Creating CSV filesof baseband signals

Processing (Simulating)signals using C program orEDA tools such as MATLAB

Converting to signalpattern files for MG3700A

FTP

User-specificSoftware

Slide 4MG3700A-E-F-11

Introduction

bull MG3700A supports Arbitrary Waveform Generator (AWG) featuresraquo Sample rate (Fs)

ndash 20 k to 160 MHzraquo Waveform memory

ndash 2times 128 Msamplechannel (1 GB)ndash 2times 256 Msamplechannel (2 GB) with Option Memory upgrade

bull Dual baseband memoryraquo DAC resolution

ndash 14 bitsraquo Marker output

ndash 3 definable TTL

bull This document presents MATLAB usage examples

3

Slide 5MG3700A-E-F-11

Modulation Basics

bull Modulation imposes source data on a passband signal with carrier frequency ƒc by using amplitude andor phase perturbations

Signal processor Carrier circuitsData Modulated signal

Modulating signalm(t)

Baseband signalg(t)

Passband signals(t)Baseband circuits RF circuits

fm-fm

Amplitude

fc+fmfc-fm fc0 f

Basebandbandwidth

Passbandbandwidth

Slide 6MG3700A-E-F-11

Modulation Transmitter

bull AM-PMtechnique

bull Quadrature (IQ)technique

Baseband signalprocessor ƒc

m(t)

R(t) v(t)=R(t) cos[ωct+θ(t)]

Baseband circuits RF circuits

sum

θ(t)φM cos[ωct+θ(t)]

ωc=2πƒc

Baseband signalprocessor

ƒcm(t)

x(t)

v(t)=x(t) cos(ωct) - y(t) sin(ωct)

Baseband circuits RF circuits

y(t)

-π2 shift

+

-

cos(ωct)

cos(ωct)

sin(ωct)

Equivalent

)()()( 22 tytxtR +=

x(t)=R(t) cosθ(t)y(t)=R(t) sinθ(t)

I

Q

4

Slide 7MG3700A-E-F-11

Baseband Waveform

Dp Phase deviation [radV]Acsin[Dpm(t)]Accos[Dpm(t)]Dpm(t)AcPM

m1(t) = plusmn1m2(t) = plusmn1

Dƒ Frequency deviation [radVmiddots]

m(t)=micro sin(2πƒmt)micro Modulation depthƒm Modulation freq

Remark

Acm2(t)Acm1(t)QM

AcFM

0Ac[1+m(t)]0Ac[1+m(t)]AM

y(t)x(t)θ(t)R(t)Modulationscheme

IQ modulationAM-PM

int infinminus

t

f dmD σσ )(

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

)()( 22

21 tmtmAc + )(

)(tan1

21

tmtmminus

QM Quadrature Modulation

Slide 8MG3700A-E-F-11

Baseband Signal

bull Any type of modulated signal may be generated using either the AM-PM technique or quadrature technique

bull Any modulation scheme can be achieved by selecting the appropriate software algorithm

bull 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

bull In digital computer simulations of passband signals the sampling rate used in the simulation can be minimized by working with thebaseband signal instead of with the passband signal s(t) because the baseband signal is equivalent of the passband signal

5

Slide 9MG3700A-E-F-11

bull CW

bull FM

bull AM

bull PSK

Fundamental IQ Constellation

I

Q

I

Q

Magnitude R(t)

I

Q

I

QPhase shiftπ2 [rad]

Ac

Ac-Ac

-Ac

Ac

Angular velocity[rads]

Ac

Ac

Ac

Ac

Slide 10MG3700A-E-F-11

Understanding Signal Pattern File

bull Signal pattern files consist of three dataraquo IQ dataraquo Marker dataraquo File header

User-created IQ dataand Marker data

wvdBinary file

wviText file

FTP

CF

FTP connection

HDD

Text file to binary fileLarge ltltlt File size gtgtgt Small

File header

IQ data scaled to DAC input values Download rarr

larr Extract

6

Slide 11MG3700A-E-F-11

IQ Data

bull The data file (wvd) contains the I and Q data points (signed 14-bit integers for each I and Q data point) Each IQ point equals onebaseband waveform point

bull 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

IQ data range DAC range IQ output voltagendash 8191 ----------------- 16383 ----------------- Vmax Positive (+) full scalendash 0 ----------------- 8191 ----------------- 0 Vndash -8192 ----------------- 0 ----------------- Vmin Negative (-) full scale

DACI data LPF

DACQ data LPF Q

I

Slide 12MG3700A-E-F-11

IQ Data Range

bull The MG3700A performance is guaranteed within IQ DAC RMS value 1157 to 1634

raquo Tunable DAC RMS value considered crest factor (peak powerRMS power)

raquo Tunable RMS power on MG3700A display

Q

+8191

+8191

-8191

-8191

+1634

+1157

0

11 dB

3 dB

210 8191log202778 asympdB

22 QI +

2210 16341634log202867 +asympdB

2210 11571157log202864 +asympdB

I

22 QI +

+1157 +1634

Margin for crest factor

7

Slide 13MG3700A-E-F-11

Marker Data

bull The marker data uses 4 bits per IQ data point to set the state of the four markers either On (1) or Off (0) for each IQ data point

bull The marker data consists of three event markers and an RF gate flag

bull 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

bull An RF gate flag is used for pulse modulation and drives the internal pulse modulator

raquo When IQ data is imported without marker data event markers are set automatically to inactive (Off) and the RF gate flag is set to active (On)

Slide 14MG3700A-E-F-11

Internal Pulse Modulator

Burst power

If the RF gate flag is not used carrier leakage occurs

Specification le -40 dBc

RF Gate flag

1

0

If the RF gate flag is used the RF output is off

Specification le -60 dBc (OnOff ratio gt 60 dB)

Power at IQ = 0

IQModulator

PulseModulatorBaseband

Generator

DelayAdjustment

RF

RF Gate

I

Q

Power at RF gate flag Off

8

Slide 15MG3700A-E-F-11

Timing

bull Because markers are set at each IQ data point the marker data contains the same number of samples as IQ data points

bull The time difference between the event markers output connector and RF connector is adjusted to be within plusmn1 sample

IQModulator

PulseModulator

BasebandGenerator

DelayAdjustment

RF

RF Gate

Marker 1Marker 2Marker 3

IQ1 IQ2 IQ3 hellip

hellip

IQ4

Gate1(1) Gate2(0) Gate3(1) Gate4(1) hellip

RFI

Q

Slide 16MG3700A-E-F-11

File Header

bull The data file (wvd) and file header (wvi) have the same file name The MG3700A stores the files in same package folder

bull The file header contains settings for the ARB modulation formatsuch as sample rate number of samples IQ DAC RMS value etc

raquo 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

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 4: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

3

Slide 5MG3700A-E-F-11

Modulation Basics

bull Modulation imposes source data on a passband signal with carrier frequency ƒc by using amplitude andor phase perturbations

Signal processor Carrier circuitsData Modulated signal

Modulating signalm(t)

Baseband signalg(t)

Passband signals(t)Baseband circuits RF circuits

fm-fm

Amplitude

fc+fmfc-fm fc0 f

Basebandbandwidth

Passbandbandwidth

Slide 6MG3700A-E-F-11

Modulation Transmitter

bull AM-PMtechnique

bull Quadrature (IQ)technique

Baseband signalprocessor ƒc

m(t)

R(t) v(t)=R(t) cos[ωct+θ(t)]

Baseband circuits RF circuits

sum

θ(t)φM cos[ωct+θ(t)]

ωc=2πƒc

Baseband signalprocessor

ƒcm(t)

x(t)

v(t)=x(t) cos(ωct) - y(t) sin(ωct)

Baseband circuits RF circuits

y(t)

-π2 shift

+

-

cos(ωct)

cos(ωct)

sin(ωct)

Equivalent

)()()( 22 tytxtR +=

x(t)=R(t) cosθ(t)y(t)=R(t) sinθ(t)

I

Q

4

Slide 7MG3700A-E-F-11

Baseband Waveform

Dp Phase deviation [radV]Acsin[Dpm(t)]Accos[Dpm(t)]Dpm(t)AcPM

m1(t) = plusmn1m2(t) = plusmn1

Dƒ Frequency deviation [radVmiddots]

m(t)=micro sin(2πƒmt)micro Modulation depthƒm Modulation freq

Remark

Acm2(t)Acm1(t)QM

AcFM

0Ac[1+m(t)]0Ac[1+m(t)]AM

y(t)x(t)θ(t)R(t)Modulationscheme

IQ modulationAM-PM

int infinminus

t

f dmD σσ )(

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

)()( 22

21 tmtmAc + )(

)(tan1

21

tmtmminus

QM Quadrature Modulation

Slide 8MG3700A-E-F-11

Baseband Signal

bull Any type of modulated signal may be generated using either the AM-PM technique or quadrature technique

bull Any modulation scheme can be achieved by selecting the appropriate software algorithm

bull 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

bull In digital computer simulations of passband signals the sampling rate used in the simulation can be minimized by working with thebaseband signal instead of with the passband signal s(t) because the baseband signal is equivalent of the passband signal

5

Slide 9MG3700A-E-F-11

bull CW

bull FM

bull AM

bull PSK

Fundamental IQ Constellation

I

Q

I

Q

Magnitude R(t)

I

Q

I

QPhase shiftπ2 [rad]

Ac

Ac-Ac

-Ac

Ac

Angular velocity[rads]

Ac

Ac

Ac

Ac

Slide 10MG3700A-E-F-11

Understanding Signal Pattern File

bull Signal pattern files consist of three dataraquo IQ dataraquo Marker dataraquo File header

User-created IQ dataand Marker data

wvdBinary file

wviText file

FTP

CF

FTP connection

HDD

Text file to binary fileLarge ltltlt File size gtgtgt Small

File header

IQ data scaled to DAC input values Download rarr

larr Extract

6

Slide 11MG3700A-E-F-11

IQ Data

bull The data file (wvd) contains the I and Q data points (signed 14-bit integers for each I and Q data point) Each IQ point equals onebaseband waveform point

bull 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

IQ data range DAC range IQ output voltagendash 8191 ----------------- 16383 ----------------- Vmax Positive (+) full scalendash 0 ----------------- 8191 ----------------- 0 Vndash -8192 ----------------- 0 ----------------- Vmin Negative (-) full scale

DACI data LPF

DACQ data LPF Q

I

Slide 12MG3700A-E-F-11

IQ Data Range

bull The MG3700A performance is guaranteed within IQ DAC RMS value 1157 to 1634

raquo Tunable DAC RMS value considered crest factor (peak powerRMS power)

raquo Tunable RMS power on MG3700A display

Q

+8191

+8191

-8191

-8191

+1634

+1157

0

11 dB

3 dB

210 8191log202778 asympdB

22 QI +

2210 16341634log202867 +asympdB

2210 11571157log202864 +asympdB

I

22 QI +

+1157 +1634

Margin for crest factor

7

Slide 13MG3700A-E-F-11

Marker Data

bull The marker data uses 4 bits per IQ data point to set the state of the four markers either On (1) or Off (0) for each IQ data point

bull The marker data consists of three event markers and an RF gate flag

bull 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

bull An RF gate flag is used for pulse modulation and drives the internal pulse modulator

raquo When IQ data is imported without marker data event markers are set automatically to inactive (Off) and the RF gate flag is set to active (On)

Slide 14MG3700A-E-F-11

Internal Pulse Modulator

Burst power

If the RF gate flag is not used carrier leakage occurs

Specification le -40 dBc

RF Gate flag

1

0

If the RF gate flag is used the RF output is off

Specification le -60 dBc (OnOff ratio gt 60 dB)

Power at IQ = 0

IQModulator

PulseModulatorBaseband

Generator

DelayAdjustment

RF

RF Gate

I

Q

Power at RF gate flag Off

8

Slide 15MG3700A-E-F-11

Timing

bull Because markers are set at each IQ data point the marker data contains the same number of samples as IQ data points

bull The time difference between the event markers output connector and RF connector is adjusted to be within plusmn1 sample

IQModulator

PulseModulator

BasebandGenerator

DelayAdjustment

RF

RF Gate

Marker 1Marker 2Marker 3

IQ1 IQ2 IQ3 hellip

hellip

IQ4

Gate1(1) Gate2(0) Gate3(1) Gate4(1) hellip

RFI

Q

Slide 16MG3700A-E-F-11

File Header

bull The data file (wvd) and file header (wvi) have the same file name The MG3700A stores the files in same package folder

bull The file header contains settings for the ARB modulation formatsuch as sample rate number of samples IQ DAC RMS value etc

raquo 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

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 5: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

4

Slide 7MG3700A-E-F-11

Baseband Waveform

Dp Phase deviation [radV]Acsin[Dpm(t)]Accos[Dpm(t)]Dpm(t)AcPM

m1(t) = plusmn1m2(t) = plusmn1

Dƒ Frequency deviation [radVmiddots]

m(t)=micro sin(2πƒmt)micro Modulation depthƒm Modulation freq

Remark

Acm2(t)Acm1(t)QM

AcFM

0Ac[1+m(t)]0Ac[1+m(t)]AM

y(t)x(t)θ(t)R(t)Modulationscheme

IQ modulationAM-PM

int infinminus

t

f dmD σσ )(

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

)()( 22

21 tmtmAc + )(

)(tan1

21

tmtmminus

QM Quadrature Modulation

Slide 8MG3700A-E-F-11

Baseband Signal

bull Any type of modulated signal may be generated using either the AM-PM technique or quadrature technique

bull Any modulation scheme can be achieved by selecting the appropriate software algorithm

bull 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

bull In digital computer simulations of passband signals the sampling rate used in the simulation can be minimized by working with thebaseband signal instead of with the passband signal s(t) because the baseband signal is equivalent of the passband signal

5

Slide 9MG3700A-E-F-11

bull CW

bull FM

bull AM

bull PSK

Fundamental IQ Constellation

I

Q

I

Q

Magnitude R(t)

I

Q

I

QPhase shiftπ2 [rad]

Ac

Ac-Ac

-Ac

Ac

Angular velocity[rads]

Ac

Ac

Ac

Ac

Slide 10MG3700A-E-F-11

Understanding Signal Pattern File

bull Signal pattern files consist of three dataraquo IQ dataraquo Marker dataraquo File header

User-created IQ dataand Marker data

wvdBinary file

wviText file

FTP

CF

FTP connection

HDD

Text file to binary fileLarge ltltlt File size gtgtgt Small

File header

IQ data scaled to DAC input values Download rarr

larr Extract

6

Slide 11MG3700A-E-F-11

IQ Data

bull The data file (wvd) contains the I and Q data points (signed 14-bit integers for each I and Q data point) Each IQ point equals onebaseband waveform point

bull 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

IQ data range DAC range IQ output voltagendash 8191 ----------------- 16383 ----------------- Vmax Positive (+) full scalendash 0 ----------------- 8191 ----------------- 0 Vndash -8192 ----------------- 0 ----------------- Vmin Negative (-) full scale

DACI data LPF

DACQ data LPF Q

I

Slide 12MG3700A-E-F-11

IQ Data Range

bull The MG3700A performance is guaranteed within IQ DAC RMS value 1157 to 1634

raquo Tunable DAC RMS value considered crest factor (peak powerRMS power)

raquo Tunable RMS power on MG3700A display

Q

+8191

+8191

-8191

-8191

+1634

+1157

0

11 dB

3 dB

210 8191log202778 asympdB

22 QI +

2210 16341634log202867 +asympdB

2210 11571157log202864 +asympdB

I

22 QI +

+1157 +1634

Margin for crest factor

7

Slide 13MG3700A-E-F-11

Marker Data

bull The marker data uses 4 bits per IQ data point to set the state of the four markers either On (1) or Off (0) for each IQ data point

bull The marker data consists of three event markers and an RF gate flag

bull 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

bull An RF gate flag is used for pulse modulation and drives the internal pulse modulator

raquo When IQ data is imported without marker data event markers are set automatically to inactive (Off) and the RF gate flag is set to active (On)

Slide 14MG3700A-E-F-11

Internal Pulse Modulator

Burst power

If the RF gate flag is not used carrier leakage occurs

Specification le -40 dBc

RF Gate flag

1

0

If the RF gate flag is used the RF output is off

Specification le -60 dBc (OnOff ratio gt 60 dB)

Power at IQ = 0

IQModulator

PulseModulatorBaseband

Generator

DelayAdjustment

RF

RF Gate

I

Q

Power at RF gate flag Off

8

Slide 15MG3700A-E-F-11

Timing

bull Because markers are set at each IQ data point the marker data contains the same number of samples as IQ data points

bull The time difference between the event markers output connector and RF connector is adjusted to be within plusmn1 sample

IQModulator

PulseModulator

BasebandGenerator

DelayAdjustment

RF

RF Gate

Marker 1Marker 2Marker 3

IQ1 IQ2 IQ3 hellip

hellip

IQ4

Gate1(1) Gate2(0) Gate3(1) Gate4(1) hellip

RFI

Q

Slide 16MG3700A-E-F-11

File Header

bull The data file (wvd) and file header (wvi) have the same file name The MG3700A stores the files in same package folder

bull The file header contains settings for the ARB modulation formatsuch as sample rate number of samples IQ DAC RMS value etc

raquo 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

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 6: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

5

Slide 9MG3700A-E-F-11

bull CW

bull FM

bull AM

bull PSK

Fundamental IQ Constellation

I

Q

I

Q

Magnitude R(t)

I

Q

I

QPhase shiftπ2 [rad]

Ac

Ac-Ac

-Ac

Ac

Angular velocity[rads]

Ac

Ac

Ac

Ac

Slide 10MG3700A-E-F-11

Understanding Signal Pattern File

bull Signal pattern files consist of three dataraquo IQ dataraquo Marker dataraquo File header

User-created IQ dataand Marker data

wvdBinary file

wviText file

FTP

CF

FTP connection

HDD

Text file to binary fileLarge ltltlt File size gtgtgt Small

File header

IQ data scaled to DAC input values Download rarr

larr Extract

6

Slide 11MG3700A-E-F-11

IQ Data

bull The data file (wvd) contains the I and Q data points (signed 14-bit integers for each I and Q data point) Each IQ point equals onebaseband waveform point

bull 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

IQ data range DAC range IQ output voltagendash 8191 ----------------- 16383 ----------------- Vmax Positive (+) full scalendash 0 ----------------- 8191 ----------------- 0 Vndash -8192 ----------------- 0 ----------------- Vmin Negative (-) full scale

DACI data LPF

DACQ data LPF Q

I

Slide 12MG3700A-E-F-11

IQ Data Range

bull The MG3700A performance is guaranteed within IQ DAC RMS value 1157 to 1634

raquo Tunable DAC RMS value considered crest factor (peak powerRMS power)

raquo Tunable RMS power on MG3700A display

Q

+8191

+8191

-8191

-8191

+1634

+1157

0

11 dB

3 dB

210 8191log202778 asympdB

22 QI +

2210 16341634log202867 +asympdB

2210 11571157log202864 +asympdB

I

22 QI +

+1157 +1634

Margin for crest factor

7

Slide 13MG3700A-E-F-11

Marker Data

bull The marker data uses 4 bits per IQ data point to set the state of the four markers either On (1) or Off (0) for each IQ data point

bull The marker data consists of three event markers and an RF gate flag

bull 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

bull An RF gate flag is used for pulse modulation and drives the internal pulse modulator

raquo When IQ data is imported without marker data event markers are set automatically to inactive (Off) and the RF gate flag is set to active (On)

Slide 14MG3700A-E-F-11

Internal Pulse Modulator

Burst power

If the RF gate flag is not used carrier leakage occurs

Specification le -40 dBc

RF Gate flag

1

0

If the RF gate flag is used the RF output is off

Specification le -60 dBc (OnOff ratio gt 60 dB)

Power at IQ = 0

IQModulator

PulseModulatorBaseband

Generator

DelayAdjustment

RF

RF Gate

I

Q

Power at RF gate flag Off

8

Slide 15MG3700A-E-F-11

Timing

bull Because markers are set at each IQ data point the marker data contains the same number of samples as IQ data points

bull The time difference between the event markers output connector and RF connector is adjusted to be within plusmn1 sample

IQModulator

PulseModulator

BasebandGenerator

DelayAdjustment

RF

RF Gate

Marker 1Marker 2Marker 3

IQ1 IQ2 IQ3 hellip

hellip

IQ4

Gate1(1) Gate2(0) Gate3(1) Gate4(1) hellip

RFI

Q

Slide 16MG3700A-E-F-11

File Header

bull The data file (wvd) and file header (wvi) have the same file name The MG3700A stores the files in same package folder

bull The file header contains settings for the ARB modulation formatsuch as sample rate number of samples IQ DAC RMS value etc

raquo 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

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 7: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

6

Slide 11MG3700A-E-F-11

IQ Data

bull The data file (wvd) contains the I and Q data points (signed 14-bit integers for each I and Q data point) Each IQ point equals onebaseband waveform point

bull 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

IQ data range DAC range IQ output voltagendash 8191 ----------------- 16383 ----------------- Vmax Positive (+) full scalendash 0 ----------------- 8191 ----------------- 0 Vndash -8192 ----------------- 0 ----------------- Vmin Negative (-) full scale

DACI data LPF

DACQ data LPF Q

I

Slide 12MG3700A-E-F-11

IQ Data Range

bull The MG3700A performance is guaranteed within IQ DAC RMS value 1157 to 1634

raquo Tunable DAC RMS value considered crest factor (peak powerRMS power)

raquo Tunable RMS power on MG3700A display

Q

+8191

+8191

-8191

-8191

+1634

+1157

0

11 dB

3 dB

210 8191log202778 asympdB

22 QI +

2210 16341634log202867 +asympdB

2210 11571157log202864 +asympdB

I

22 QI +

+1157 +1634

Margin for crest factor

7

Slide 13MG3700A-E-F-11

Marker Data

bull The marker data uses 4 bits per IQ data point to set the state of the four markers either On (1) or Off (0) for each IQ data point

bull The marker data consists of three event markers and an RF gate flag

bull 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

bull An RF gate flag is used for pulse modulation and drives the internal pulse modulator

raquo When IQ data is imported without marker data event markers are set automatically to inactive (Off) and the RF gate flag is set to active (On)

Slide 14MG3700A-E-F-11

Internal Pulse Modulator

Burst power

If the RF gate flag is not used carrier leakage occurs

Specification le -40 dBc

RF Gate flag

1

0

If the RF gate flag is used the RF output is off

Specification le -60 dBc (OnOff ratio gt 60 dB)

Power at IQ = 0

IQModulator

PulseModulatorBaseband

Generator

DelayAdjustment

RF

RF Gate

I

Q

Power at RF gate flag Off

8

Slide 15MG3700A-E-F-11

Timing

bull Because markers are set at each IQ data point the marker data contains the same number of samples as IQ data points

bull The time difference between the event markers output connector and RF connector is adjusted to be within plusmn1 sample

IQModulator

PulseModulator

BasebandGenerator

DelayAdjustment

RF

RF Gate

Marker 1Marker 2Marker 3

IQ1 IQ2 IQ3 hellip

hellip

IQ4

Gate1(1) Gate2(0) Gate3(1) Gate4(1) hellip

RFI

Q

Slide 16MG3700A-E-F-11

File Header

bull The data file (wvd) and file header (wvi) have the same file name The MG3700A stores the files in same package folder

bull The file header contains settings for the ARB modulation formatsuch as sample rate number of samples IQ DAC RMS value etc

raquo 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

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 8: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

7

Slide 13MG3700A-E-F-11

Marker Data

bull The marker data uses 4 bits per IQ data point to set the state of the four markers either On (1) or Off (0) for each IQ data point

bull The marker data consists of three event markers and an RF gate flag

bull 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

bull An RF gate flag is used for pulse modulation and drives the internal pulse modulator

raquo When IQ data is imported without marker data event markers are set automatically to inactive (Off) and the RF gate flag is set to active (On)

Slide 14MG3700A-E-F-11

Internal Pulse Modulator

Burst power

If the RF gate flag is not used carrier leakage occurs

Specification le -40 dBc

RF Gate flag

1

0

If the RF gate flag is used the RF output is off

Specification le -60 dBc (OnOff ratio gt 60 dB)

Power at IQ = 0

IQModulator

PulseModulatorBaseband

Generator

DelayAdjustment

RF

RF Gate

I

Q

Power at RF gate flag Off

8

Slide 15MG3700A-E-F-11

Timing

bull Because markers are set at each IQ data point the marker data contains the same number of samples as IQ data points

bull The time difference between the event markers output connector and RF connector is adjusted to be within plusmn1 sample

IQModulator

PulseModulator

BasebandGenerator

DelayAdjustment

RF

RF Gate

Marker 1Marker 2Marker 3

IQ1 IQ2 IQ3 hellip

hellip

IQ4

Gate1(1) Gate2(0) Gate3(1) Gate4(1) hellip

RFI

Q

Slide 16MG3700A-E-F-11

File Header

bull The data file (wvd) and file header (wvi) have the same file name The MG3700A stores the files in same package folder

bull The file header contains settings for the ARB modulation formatsuch as sample rate number of samples IQ DAC RMS value etc

raquo 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

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 9: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

8

Slide 15MG3700A-E-F-11

Timing

bull Because markers are set at each IQ data point the marker data contains the same number of samples as IQ data points

bull The time difference between the event markers output connector and RF connector is adjusted to be within plusmn1 sample

IQModulator

PulseModulator

BasebandGenerator

DelayAdjustment

RF

RF Gate

Marker 1Marker 2Marker 3

IQ1 IQ2 IQ3 hellip

hellip

IQ4

Gate1(1) Gate2(0) Gate3(1) Gate4(1) hellip

RFI

Q

Slide 16MG3700A-E-F-11

File Header

bull The data file (wvd) and file header (wvi) have the same file name The MG3700A stores the files in same package folder

bull The file header contains settings for the ARB modulation formatsuch as sample rate number of samples IQ DAC RMS value etc

raquo 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

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 10: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

9

Slide 17MG3700A-E-F-11

Data File Size

bull The data file (wvd) is loaded into baseband memory meaning that the occupied memory size equals the data file size

bull A baseband waveform consists of samples One sample contains 4 bytes

raquo IQ Data + Marker Data = 1 Waveform Sample14 bits I 4 bits 4 bytes (32 bits)14 bits Q

ChannelI Q ( Marker 1 Marker 2 Marker 3 RF gate flag)

Maximum of256000000 sample512000000 sample with Option

Sampling rate (sample per second) FsSampling frequency expressed in Hz

Sampling interval Ts=1FsTime between samples in uniform sampling

Slide 18MG3700A-E-F-11

Programming Examples to Create IQ Data File

bull There are various programming environments to create ARB IQ data

Generally there are two typesraquo Simulation software (EDA tool)

ndash MATLAB Microwave Office etcraquo Advanced programming languages

ndash CC++ VB LabView etc

bull The example uses MATLAB and shows the programmable M-filesraquo M-file MATLAB program for command script

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 11: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

10

Slide 19MG3700A-E-F-11

Analog Modulation

bull Analog modulation schemes are most basic techniques and it is simple to create IQ data

Basic analog modulation schemesraquo Amplitude Modulation (AM)raquo Frequency Modulation (FM)raquo Phase Modulation (PM)

I

Q Modulation depth []micro = Vp Ac

Ac

I

Q

I

Q Phase shiftπ2 [rad]

Vp

AM FM PM

VpAngular velocity

[rads]

Ac

Ac Ac

Ac

Slide 20MG3700A-E-F-11

AM

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

s(t)

-2

-15

-1

-05

0

05

1

15

2

t

Am

plitu

de [V

]

Modulation depth micro 80 []

Envelop R(t)

Carrier

Modulated signal

m(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 12: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

11

Slide 21MG3700A-E-F-11

AM Programming Example

bull I = x(t) = Ac[1+m(t)] = 1+micro sin(2πƒmt)bull Q = y(t) = 0

bull Ac Carrier signal amplitude = 1bull micro Modulation depth = Modulating signal peakCarrier signal peak (amplitude)

clear all close all clc

fm = 1 Modulating frequency [kHz]Depth = 08 Modulating depthCSVfile = AM1kHzDepth80csv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = 1+Depthsin(2pifmtDataPoints)Q = zeros(1DataPoints)data = [I Q]csvwrite(CSVfiledata)

Slide 22MG3700A-E-F-11

FMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Df

-60

-40

-20

0

20

40

60

t

Freq

uenc

y de

viat

ion

[kH

z]

s(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal

Peak frequency deviation ∆ƒ 50 [kHz]

c(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulated signalCarrier

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 13: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

12

Slide 23MG3700A-E-F-11

FM Programming Example

bull I = x(t) = = cos[β sin(2πƒmt)]bull Q = y(t) = = sin[β sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull β Modulation index = ∆ƒƒmbull ∆ƒ Peak frequency deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 50 Peak frequency deviation [kHz]CSVfile = FM1kHzDeviation50kHzcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationfmsin(2pifmtDataPoints))Q = sin(Deviationfmsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

Slide 24MG3700A-E-F-11

PMm(t)

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

Modulating signal Dp

-2

-15

-1

-05

0

05

1

15

2

t

Pha

se d

evia

tion

[π r

ad]

Peak phase deviation 5 [rad] asymp 16 π [rad]

-15

-1

-05

0

05

1

15

t

Am

plitu

de [V

]

c(t) s(t) Modulated signalCarrier

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 14: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

13

Slide 25MG3700A-E-F-11

PM Programming Example

bull I = x(t) = Ac cos[Dp m(t)] = cos[Dp sin(2πƒmt)]bull Q = y(t) = Ac sin[Dp m(t)] = sin[Dp sin(2πƒmt)]

bull Ac Carrier signal amplitude = 1bull Dp Peak phase deviation

clear all close all clc

fm = 1 Modulating frequency [kHz]Deviation = 5 Peak phase deviation [kHz]CSVfile = PM1kHzDeviation5radcsv

DataPoints = 1000Fs = fmDataPoints Sampling rate [kHz]

t = 0DataPoints-1I = cos(Deviationsin(2pifmtDataPoints))Q = sin(Deviationsin(2pifmtDataPoints))data = [I Q]csvwrite(CSVfiledata)

Slide 26MG3700A-E-F-11

Pulse Modulation

bull Pulse modulation is used for radar and satellite signals using acombination with either FM or PM and time-multiplexed burst signals

ndash PRFPRR Pulse repetition frequency rate [pps] [pulses]ndash Pulse period [s] 1PRFndash Pulse width duration [s] Including rise timendash Duty ratio cycle [] Pulse widthPulse periodndash Pulses per burst [pulsesburst]ndash Burst length [s]ndash Burst period [s]ndash Rise time [s] Pulse period

Pulse width

Pulses per burstBurst length Burst period

Rise time

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 15: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

14

Slide 27MG3700A-E-F-11

Pulse Modulation Programming Example

bull I = x(t) = Ac = 1bull Q = y(t) = Ac = 1

bull Ac Carrier signal amplitude = 1bull PRF 700 [pps]bull Pulse width 1 [micros]bull Pulsesburst 18bull Burst period 10 [s]

clear all close all clc

PRF = 700 [pps]PulseWidth = 1E-6 [s]PulsesPerBurst = 18 [pulsesburst]BurstPeriod = 10 [s]CSVfile = Pulse700ppsW1us18ppbB10scsvzerofile = Pulse700ppsW1us18ppbB10sZerocsv

Fs = LCM(PRF1PulseWidth) Sampling rate [Hz] LCM Least Common Multiple Number of samplesW = PulseWidthFsPulseGap = (1PRF-PulseWidth)Fs

(Continued on the next page)

CW

Slide 28MG3700A-E-F-11

Pulse Modulation Programming Example

(Continued from previous page)

I = [ ones(1W+2) zeros(1PulseGap-2) ]Q = [ ones(1W+2) zeros(1PulseGap-2) ]RFgateFlag = [ zeros(11) ones(1W) zeros(1PulseGap) ]Burst = [ zeros(11) ones(1W) ]for n = 2PulsesPerBurst

I = [ I ones(1W+2) zeros(1PulseGap-2) ]Q = [ Q ones(1W+2) zeros(1PulseGap-2) ]Burst = [ Burst ones(1PulseGap+W) ]if n == PulsesPerBurst

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap-1) ]else

RFgateFlag = [ RFgateFlag ones(1W) zeros(1PulseGap) ]end

end

Marker1 = [ Burst zeros(1PulseGap-1) ] BurstMarker2 = RFgateFlag PulseMarker3 = RFgateFlag Pulsedata = [I Q Marker1 Marker2 Marker3 RFgateFlag]csvwrite(CSVfiledata)

BurstGapPulseLength = PRFBurstPeriod-PulsesPerBurstzero = zeros(1FsPRF) samplespulsezerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)zerofileMultiple = PRFBurstPeriod-PulsesPerBurst Pulse length in Burst gap

IQ(DC)

RF gate flag

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 16: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

15

Slide 29MG3700A-E-F-11

Pulse Modulation Programming Example

Repeat

Sequence feature technique

Slide 30MG3700A-E-F-11

Pulse Modulation Programming Example

RepeatElement 1 Element 2

Create a sequence file

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 17: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

16

Slide 31MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

bull I = x(t) =bull Q = y(t) =

bull Ac Carrier signal amplitude = 1bull PRF 2000 [pps]bull Pulse width 20 [micros]bull Pulsesburst 20

clear all close all clc

PW = 20 Pulse Width [us]PRF = 2000 [pps]Fpeak = 25 Peak Frequency Deviation [MHz]CSVfile = RTS6W20us2000ppscsvzerofile =RTS6W20us2000ppsZerocsv

Fs = Fpeak 40 Sampling rate [MHz]DataPoints = PW Fs

(Continued on the next page)

int infinminus

t

fc dmDA σσ )(cos

int infinminus

t

fc dmDA σσ )(sin

FM

Slide 32MG3700A-E-F-11

Pulse Chirp Modulation Programming Example

(Continued from previous page)

t = 0DataPointsdPhi = 2pi(-Fpeak + 2 Fpeak tDataPoints)Fs Frequency deviation from -Fpeak to

+FpeakPhi = cumsum(dPhi2) Comulative SumI = cos(Phi)Q = sin(Phi)

I = [zeros(11) I zeros(12)]Q = [zeros(11) Q zeros(12)]BurstFlag = ones(1DataPoints+4)RFgateFlag = [ones(1DataPoints+3) zeros(11)]

data=[I Q BurstFlag RFgateFlag RFgateFlag RFgateFlag] Marker1 Burst OnOff Flag Marker2amp3 RF OnOff Flag

csvwrite(CSVfiledata)

zero = zeros(1DataPoints+4)zerodata = [zero zero zero zero zero zero]csvwrite(zerofilezerodata)

PulsePeriod = Fs 1E6 PRF Pulse period samplesFrameLength = DataPoints + 4GapLength = PulsePeriod - DataPoints - 4

IQ

RF gate flag

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 18: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

17

Slide 33MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleSequence feature technique

Command Window

Repeat Repeat

Slide 34MG3700A-E-F-11

Pulse Chirp Modulation Programming ExampleCreate a sequence file

Repeat Repeat

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 19: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

18

Slide 35MG3700A-E-F-11

PSK QAM

bull Digital modulation schemes change the amplitude frequency and phase of the carrier at regular time intervals and sends a digital baseband signal

raquo Analog modulation schemes change the carrier amplitude frequency and phase continuously

Basic digital modulation schemesraquo Amplitude Shift Keying (ASK)

ndash The amplitude of the carrier varies linearly with the symbol sequenceraquo Frequency Shift Keying (FSK)

ndash The frequency of the carrier varies linearly with the symbol sequenceraquo Phase Shift Keying (PSK)

Differential Phase Shift Keying (DPSK)ndash The phase of the carrier varies linearly with the symbol sequence

raquo Quadrature Amplitude Modulation (QAM)ndash The amplitude and phase of the carrier varies linearly with the symbol

sequence

1 10

Slide 36MG3700A-E-F-11

PSK QAM

bull This chapter shows common examples for QPSK π4DQPSK 8PSK 16QAM

I

Q

00

Ac-Ac

-Ac

Ac

QPSK

01

10

11

I

Q

Ac-Ac

-Ac

Ac

π4DQPSK

00

01 1011

IAc-Ac

-Ac

Ac

000

001

010

011

Q

100

101

110

111

IAc-Ac-Ac

Ac

0000

0001

0010

0011

Q

1100

1101

1110

1111

8PSK 16QAM

0101

0100

0111

0110

10101000

10111001

3Ac-3Ac

3Ac

-3Ac

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 20: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

19

Slide 37MG3700A-E-F-11

QPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=QPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) Initial phase

pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

Slide 38MG3700A-E-F-11

QPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 round(min(real(g))) round(max(real(g)))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 round(min(imag(g))) round(max(imag(g)))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 21: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

20

Slide 39MG3700A-E-F-11

Waveform Phase Continuity

bull The MG3700A plays back a waveform of finite in length and repeats it continuously Phase discontinuity between the end of one waveform and the start of the next repetition can lead to periodic spectral regrowth and distortion

bull Repetitions with abrupt phase changes result in high frequency spectral regrowth

For Pd = 16 symbol pointswaveformSymbol data length Duplicate symbol data

Waveform length

Slide 40MG3700A-E-F-11

π4DQPSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=pi4DQPSKcsv

M = 4 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = dpskmod(DuplicateSymbolDataMpi4) Complex envelop g(t) using phase

shift pi4 rad [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 22: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

21

Slide 41MG3700A-E-F-11

π4DQPSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 42MG3700A-E-F-11

8PSK

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=8PSKcsv

M = 8 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 23: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

22

Slide 43MG3700A-E-F-11

8PSK

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 44MG3700A-E-F-11

16QAM

Complex envelopbull g(t) = Ac[m1(t)+jm2(t)] = I(t)+jQ(t)

bull Ac Carrier signal amplitude = 1

clear all close all clc

Fd = 1 Symbol rate [sps]Fs = 10Fd Oversampling ratePd = 256 Symbol pointsrepetition = 2 Repetition factor of dataR = 05 Rolloff factor for FIR filterdelay = 3 Filters group delayCSVfile=16QAMcsv

M = 16 Point signal constellationsSymbolData = randint(Pd1M) Random data [Communications Toolbox] Duplicate the symbol data because of waveform phase continuityDuplicateSymbolData = repmat(SymbolDatarepetition1) Replicate the symbol

data [Fixed-Point Toolbox]g = pskmod(DuplicateSymbolDataM) Complex envelop g(t) [Communications Toolbox]

(Continued on the next page)

MATLAB requiresSignal Processing ToolboxCommunications Toolbox

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 24: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

23

Slide 45MG3700A-E-F-11

16QAM

(Continued from previous page)

filtering = rcosflt(gFdFsfirnormalRdelay) Filter input signal using FIR filter [Communications Toolbox]

OversampledData = filtering(Fsdelay2+1Fsdelay2+FsPd) Correct filter delaydata = [real(OversampledData) imag(OversampledData)] IQ datacsvwrite(CSVfiledata)

scatterplot(OversampledData10b-)hold onplot(gr)grid Signal constellation

figure Complex envelopt_g = 0Pdrepetition-1 g(t) symbol numbert_o = delayFdFsdelay+Pd-1Fs Oversampled symbol numbersubplot(211)stem(t_greal(g)r)hold onplot(t_oreal(OversampledData))grid In-phaseaxis([-1 Pdrepetition+1 min(real(OversampledData)) max(real(OversampledData))])title(I signal)xlabel(Symbol)ylabel(Amplitude)subplot(212)stem(t_gimag(g)r)hold onplot(t_oimag(OversampledData))grid

Quadrature-phaseaxis([-1 Pdrepetition+1 min(imag(OversampledData)) max(imag(OversampledData))])title(Q signal)xlabel(Symbol)ylabel(Amplitude)

Slide 46MG3700A-E-F-11

Simulink

bull What is Simulinkraquo Simulinkreg 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

bull Tool for simulationraquo You can easily build models from scratch or take an existing model and

add to it It offers instant access to all the analysis tools in MATLAB so the results can be taken and analyzed and visualized

bull Tool for model-based designraquo For modeling Simulink offers a GUI for building models as block

diagrams using click-and-drag mouse operations You can also customize and create your own blocks

raquo Models are hierarchical so they can be built using both top-down and bottom-up approaches

raquo After defining a model you can simulate it Simulation results can be put in the MATLAB workspace for post-processing and visualization

CSV file

For more information on Simulink visit the MathWorks website httpwwwmathworkscomaccesshelpdeskhelptoolboxsimulink

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 25: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

24

Slide 47MG3700A-E-F-11

Simulink Demos

bull Simulink demos illustrate useful modeling concepts Access demos from the MATLAB Command Window

Slide 48MG3700A-E-F-11

Simulink Blockset Demos

bull The Blocksets are the collections of specialized Simulink blocks designed for design and simulation in a particular field

bull For example the Communications Blockset extends Simulink with a comprehensive library of blocks to design and simulate the physical layer of communication systems and components The blocksethelps design for communications systems and their semiconductor components such as commercial or defense wireless and wire systems

Model of physical layer of IEEE 80211a Wireless LAN standardincluding adaptive modulation using blocks in Communications Blockset

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 26: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

25

Slide 49MG3700A-E-F-11

Simulation Data Save Technique

bull Simulink Library Browserraquo The Math Operations library contains blocks for modeling general

mathematical functionsraquo The Sinks library contains blocks that display or write block output

Libraries

Blocks

Blocks

Slide 50MG3700A-E-F-11

Complex to Real-Imag

bull Output real and imaginary parts of complex input signalndash The Complex to Real-Imag block accepts a complex-valued signal of any data type

supported by Simulink including fixed-point data types It outputs the real andor imaginary part of the input signal depending on the setting of the Output parameter The real outputs are of the same data type as the complex input The input can be an array (vector or matrix) of complex signals in which case the output signals are arrays of the same dimensions The real array contains the real parts of the corresponding complex input elements The imaginary output similarly contains the imaginary parts of the input elements

I Q

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 27: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

26

Slide 51MG3700A-E-F-11

Complex to Real-Imag

bull Parametersraquo Output

ndash This parameter determines the output of this block Choose from the following values Real and imag (outputs the input signals real and imaginary parts) Real (outputs the inputs real part) Imag (outputs the inputs imaginary part)

raquo Sample time (-1 for inherited)ndash This parameter specifies the time interval between samples To inherit the sample time

set this parameter to -1-1ndash If the block is not in a triggered subsystem this setting specifies that the block inherits its

sample time from the block connected to its input (inheritance) or in some cases from the block connected to its output (back inheritance) If the block is in a triggered subsystem set the SampleTime parameter to this settingNote that specifying sample-time inheritance for a source block can cause Simulink to assign an inappropriate sample time to the block if the source drives more than one block For this reason avoid specifying sample-time inheritance for source blocks If it is specified Simulink displays a warning message when updating or simulating the model

Slide 52MG3700A-E-F-11

To Workspace

bull Write data to workspacendash 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 blocks Variable name parameter The Save format parameter determines the output format

Array

I or Q

inf IEEE arithmetic representation for positive infinity

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 28: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

27

Slide 53MG3700A-E-F-11

To Workspace

raquo Arrayndash Selecting this option causes the To Workspace block to save the input as an N-

dimensional 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 (ie a vector) the resulting workspace array is two-dimensional If the input signal is a 2-D array (ie a matrix) the array is three-dimensional

ndash 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

ndash Block parameters control when and how much data the To Workspace block writes1 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

Slide 54MG3700A-E-F-11

To Workspace

ndash For variable-step solvers the Output options found on the Data ImportExport 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

ndash 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

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 29: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

28

Slide 55MG3700A-E-F-11

To Workspace

bull Parametersraquo Variable name

ndash Name of array holding data

raquo Limit data points to lastndash Maximum number of input samples saved (The default is inf samples)

raquo Decimationndash Decimation factor (The default is 1)

raquo Sample timendash Sample time at which to collect points

raquo Save formatndash Format in which to save simulation output to workspace (The default is structure)

raquo Log fixed-point data as a fi objectndash Select to log fixed-point data to MATLAB workspace as Simulink Fixed-Point fi object

Otherwise fixed-point data is logged to the workspace as double

Slide 56MG3700A-E-F-11

Simulation Data Save Example 1

bull Open completed modelbull Communications Blockset Helpgt Examples in Documentationgt Digital Modulationgt DQPSK Signal Constellation Points and Transitions

ndash open(MATLAB701helptoolboxcommblkscommblks_examplesdoc_dqpsk_plotmdl)

bull The model plots the output of the DQPSK Modulator Basebandblock The image shows the possible transitions from each symbol in the DQPSK signal constellation to the next symbol

ndash Running the model produces the plot The plot reflects the transitions among the eight DQPSK constellation points

ndash This plot illustrates π4DQPSK modulation because the default Phase offset parameter in the DQPSK Modulator Baseband block is pi4

I

Q

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 30: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

29

Slide 57MG3700A-E-F-11

Communications Blockset Example Editing

Drag and drop

Array

I or Q

Start a Simulation

Slide 58MG3700A-E-F-11

Note

bull When the MG3700A generates this IQ signal a raised cosine FIR filter block must be added to the model

bull For more information about the raised cosine FIR filter blockhttpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksrefraisedcosinetransmit

filterhtmlndash Upsample and filter input signal using raised cosine FIR filter

Drag and drop

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 31: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

30

Slide 59MG3700A-E-F-11

Simulation Data Save Example 2

bull Open completed modelbull Communications Blockset Demosgt Channel Models and Impairmentsgt Rayleigh Fading Channelbull For more information about channels

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommblksugfp62122htmlbull For more information about fading channels in general

httpwwwmathworkscomaccesshelpdeskhelptoolboxcommuga1069449399html

bull The model illustrates the channels effect on a QPSK modulated signal

ndash Running the model produces the plot The plot reflects the channels effect on the QPSK constellation points

Slide 60MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 32: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

31

Slide 61MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

8 OSR

Trajectory

Start a Simulation

Slide 62MG3700A-E-F-11

Simulation Data Save Example 3

bull Open the completed modelbull Communications Blockset Demosgt Application-Specific Examplesgt IEEE 80211a WLAN Physical Layer

bull IEEE 80211ag WLAN OFDM physical layer model demonstrating adaptive modulation and coding

ndash Requirements Communications Toolbox Communications Blockset Signal Processing Blockset Signal Processing Toolbox

ndash End-to-end 80211a physical layerndash All mandatory and optional data rates 6 9 12 18 24 36 48 and 54 Mbsndash BPSK QPSK 16QAM 64QAM modulationsndash Forward error correction coding (convolutional code rates 12 23 34)ndash OFDM transmission 52 subcarriers 4 pilots 64-pt FFTs CP (Cyclic Prefix)ndash Data interleavingndash PLCP preamble (modeled as 2x2 long training sequences)ndash Receiver equalizationndash Viterbi decodingndash Data rates selectable on-the-flyndash Adaptive modulation demo over dispersive multipath fading channel

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 33: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

32

Slide 63MG3700A-E-F-11

Communications Blockset Demo

ndash Running the model and double-clicking Signal Visualization block produce the plot

SignalVisualization

TX Data

RX power spectrum

Unequalized signal

Equalized power spectrum

SNR Bit rate

BER (per packet)

Slide 64MG3700A-E-F-11

Communications Blockset Demo

NRZ(Non-Return to Zero)

PER = 150 (2 )in this case

16QAMin this case

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 34: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

33

Slide 65MG3700A-E-F-11

Communications Blockset Demo Editing

Drag and drop

Drag and drop

Slide 66MG3700A-E-F-11

Communications Blockset Demo Editing

Array

I or Q

Start a Simulation

Measured power spectrum

Convert in IQproducer

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 35: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

34

Slide 67MG3700A-E-F-11

Workspace Data Save

bull To save the workspace variables as a CSV file run the command by entering the following in the MATLAB command window

raquo data = [I Q]raquo csvwrite(IQdatacsvdata)

ndash The workspace is the set of variables (named arrays) stored in memory during a MATLAB session

Workspace variables

Memory File

CSV text

data IQdatacsv

Slide 68MG3700A-E-F-11

Programming Example to Convert and Transfer IQ Data File without IQproducer

bull To download IQ data to the MG3700A typically it is easier to use Convert and Transfer amp Setting in IQproducer because MATLAB (simulation software) and C++ (advanced programming language) can usually save the data as a CSV file

bull This process takes more time because a text file is larger and it is a bother

bull To minimize the time to convert a IQ data file create a specific binary data file

bull This section examines how to facilitate downloading a complex data array from within the MATLAB environment

1 Creating GUI with GUIDE2 Executing [Convert]3 Executing [Transfer] and [Play]

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 36: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

35

Slide 69MG3700A-E-F-11

Creating GUI with GUIDE

raquo GUIDE the MATLAB graphical user interface development environment provides a set of tools for creating graphical userinterfaces (GUIs) These tools simplify the process of laying out and programming GUIs

bull GUI Layoutndash Using the GUIDE Layout Editor populate a GUI by clicking and dragging GUI

components such as axes panels buttons text fields sliders etc into the layout area You can also create menus and context menus for the GUI The GUIDE saves a GUI layout to a FIG-file

bull GUI Programmingndash 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

bull For more information about GUIDEhttpwwwmathworkscomaccesshelpdeskhelptechdoccreating_guiscreating_guishtml

FIG-file

Slide 70MG3700A-E-F-11

Executing [Convert]

Programming Flowchart

Create parameter file for converting

Create data file for converting

Create WVI and WVD files

Input strings

Parameter text file for converting

Data binary file for converting

File header wvi Data file wvdWorkspace variable

Delete parameter and data files

Files

MarkersI QArrayEditor

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 37: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

36

Slide 71MG3700A-E-F-11

Executing [Transfer] and [Play]

Programming Flowchartndash [Transfer] Transfer files to MG3700A HDD using FTP

ndash [Play] Load pattern data to baseband memory with TCPIP remote control

Connect to MG3700A creating FTP object

Check existing package folder or make new package folder in MG3700A HDD

Download WVI and WVD files

Create TCPIP object

Load pattern data to baseband memory

Play back signal pattern

Slide 72MG3700A-E-F-11

Example of Creating GUI with GUIDE

bull GUIDE saves GUI layout to convandtranstoolfigbull GUIDE automatically makes convandtranstoolm

M-file

function varargout = convandtranstool(varargin) CONVANDTRANSTOOL M-file for convandtranstoolfig 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(CALLBACKhObjecteventDatahandles) calls the local function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments CONVANDTRANSTOOL(PropertyValue) 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 GUIDEs 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

FIG-file

M-file function

M i

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 38: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

37

Slide 73MG3700A-E-F-11

Call M-file Function

ndash M-files can be either scripts or functions Scripts are simply files containing a sequence of MATLAB statements Functions make use of their own local variables and accept input arguments

ndash The name of a function as defined in the first line of the M-file should be the same as the name of the file without the m extension

ndash The variables within the body of the function are all local variablesndash When calling an M-file function from the command line or from within

another M-file MATLAB parses the function and stores it in memory The parsed function remains in memory until cleared using the clear command or quitting MATLAB

I_Q = [real(OversampledData) imag(OversampledData)] IQ data

RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))I_Q = round(I_Q1634RMSvalue) To integer

marker1 = [ ones(101) zeros(length(I_Q)-101) ]marker2 = zeros(length(I_Q)1)marker3 = zeros(length(I_Q)1)gate = ones(length(I_Q)1) RF gate flagmarker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^0data = [I_Q marker_gate]

convandtranstool Call M-file function

Convert decimal fraction to 16-bit integer

Equal to variable ldquodatardquo in previous section

Workspace variableArrayEditor

Slide 74MG3700A-E-F-11

Convert Programming Example

--- Executes on button press in pushbutton2function pushbutton2_Callback(hObject eventdata handles) hObject handle to pushbutton2 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Create parameter file for convertingvalname = get(handlesedit1 String)package = get(handlesedit9 String)patname = get(handlesedit2 String)samprate = get(handlesedit10 String)rmsval = get(handlesedit3 String)oversamp = get(handlesedit4 String)sysunit = get(handlesedit5 String)framelen = get(handlesedit11 String)if isempty(package)

package = Convert_IQproducerEnd

(Continued on the next page)

Get input strings

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 39: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

38

Slide 75MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

fid = fopen(wave_infodat w)fprintf(fid [Wave Info]yenn)fprintf(fid Soft Type = MX3700yenn) If using for MG3700 fprintf(fid Soft Type = MX2690yenn) If using for MS2690fprintf(fid [Package = package yenn])fprintf(fid [Pattern Name = patname yenn])fprintf(fid [Sampling Rate = samprate Hzyenn])if ~isempty(oversamp)

fprintf(fid [Over Sampling = oversamp yenn])endif ~isempty(sysunit)

fprintf(fid [System Unit = sysunit yenn])endif ~isempty(framelen)

fprintf(fid [Frame Length = framelen yenn])endif ~isempty(rmsval)

fprintf(fid [WVI RMS Value = rmsval yenn])fprintf(fid [WVD RMS Value = rmsval yenn])

endfprintf(fid Marker1 = Headyenn)fprintf(fid Marker2 = yenn)fprintf(fid Marker3 = yenn)

(Continued on the next page)

Open file or create new file for writing

Slide 76MG3700A-E-F-11

Convert Programming Example

(Continued from previous page)

Define the following parameters in case of burst signalfprintf(fid [Rf Gate]yenn)fprintf(fid Rf On Off Threshold = 1yenn)fprintf(fid Min Rf Gate Length = 100samplesyenn)

fclose(fid) Close the open file

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 40: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

39

Slide 77MG3700A-E-F-11

Convert Programming Example

bull Create data file for convertingevalin(base fid_r = fopen(wave_rawdat w))evalin(base [fwrite(fid_r valname int16)])evalin(base fclose(fid_r))evalin(base clear fid_r)

bull Create WVI and WVD filesMakeWvFile wave_infodat wave_rawdat

bull Delete parameter and data filesdelete(wave_infodat)delete(wave_rawdat)

Open file or create new file for writing

Write binary data with integer 16 bits to file

Close open file

Execute EXE file

Remove items from workspace freeing up system memory

Slide 78MG3700A-E-F-11

Create WVI and WVD files MakeWvFile

bull The MakeWvFileexe application software is provided by Anritsubull It creates the data file (wvd) and file header (wvi) from the specific

binary data file

bull Function referenceraquo Syntax

ndash MakeWvFile ParameterFilename DataFilename

raquo Argumentsndash ParameterFilename Text filename for file header (wvi)ndash DataFilename Specific binary data filename for data file (wvd)

MakeWvFileParameter text file for converting

Data binary file for converting

File header wvi

Data file wvd

Command Prompt

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 41: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

40

Slide 79MG3700A-E-F-11

Parameter text file for MakeWvFile

bull [Wave Info]raquo Soft Type

bull MX3700For MG3700A

bull MX2690For MS2690A-20 (VSG option)ndash If the parameter is blank MX3700 is set

raquo Packagendash Folder name for pattern file

bull le 30 charactersndash If the parameter is blank Convert_IQproducer is set

raquo Pattern Namebull le 20 characters

raquo Sampling Ratendash Number of IQ waveform samples per second (expressed in Hz and equal

to reciprocal of sampling interval)bull 20000 to 160000000Hz (20 kHz to 160 MHz)

Resolution 0001 Hz

raquo Over Samplingndash Oversampling ratio (OSR) Ratio of sampling rate to modulation rate

bull 1 to 999ndash If the parameter is blank 1 is set

Slide 80MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo System Unitndash Modulation point for modulation rate ie chip symbol sample

bull le 6 charactersndash If the parameter is blank None is set

raquo Frame Lengthndash Frame sample length

bull 1 to 8388607ndash If the parameter is blank Input Frame Trigger cannot be used

raquo WVI RMS Valuendash IQ DAC amplitude adjust to SG output level

bull 1 to 8191Note In the case of Soft Type = MX2690 set 1157ndash If the parameter is blank RMSIQ calculated from data file is set

raquo WVD RMS Valuendash RMSIQ for adjustment of IQ amplitude in data file

bull 1 to 8191ndash If the parameter is blank IQ amplitude in data file is not changed

n Data with RF gate flag active (On)N

QIRMS

N

nnn

QI 2

)(1

22

sum=

+=

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 42: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

41

Slide 81MG3700A-E-F-11

Parameter text file for MakeWvFile

raquo Marker1raquo Marker2raquo Marker3

ndash Event marker name indicated on MG3700A (or MS2690A) displaybull le 31 characters

ndash If the parameter is blank it isnrsquot indicated on MG3700A (or MS2690A) display

Slide 82MG3700A-E-F-11

Parameter text file for MakeWvFile

Using RF Gate optimizes RF gate flag to scale IQ data within burst signal

In the case of no burst signal these parameters can be skippedbull [RF Gate]

raquo Rf On Off Thresholdndash Threshold level for automatic detection of no signal and activeinactive

(OnOff) definition of RF gate flagbull 0 to 100

100 reference level Peak ndash If the parameter is blank RF gate flag is not changed

raquo Min Rf Gate Lengthndash Minimum consecutive samples for automatic detection of no signal and

inactive (Off) definition of RF gate flagbull 0 to 100000 samples

ndash If the parameter is blank RF gate flag is not changed

22nn QI +

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 43: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

42

Slide 83MG3700A-E-F-11

RF Gate Parametersndash Blue line

bull Data (wvd) with RF Gatendash RMSIQ (0 dB) is

calculated from burst IQ data

ndash Red linebull Data (wvd) without RF

Gatendash RMSIQ (0 dB) is

calculated from all IQ data

Peak level(+129892 dB)

Rf On Off Threshold1 (-40 dB)

Crest Factor129892 dB

RF gate flag

Min Rf Gate Lengthge 100 samples

Slide 84MG3700A-E-F-11

Data binary file for MakeWvFile

bull Specific binary data file formatraquo Each data point needs 6 bytes as 2 bytes for the I point 2 bytes for the

Q point 1 byte for three event markers and 1 byte for the RF gate flag

MakeWvFileData binary file for converting Data file wvd

4 bytespoint6 bytespoint

RF gate flag1 byte

I2 bytes

Q2 bytes

3 Event markers1 byte

16-bit signed integer 16-bit signed integer 0000 00010000 0111

0000 00000000 0000

Point

1

2

3

1 Active (On)

0 Inactive (Off)

1st bit Marker 12nd bit Marker 23rd bit Marker 3

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 44: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

43

Slide 85MG3700A-E-F-11

Data binary file for MakeWvFile

raquo IQ binary data is 16-bit tworsquos complement representing signed integers

IQ data range Binary data HEX data IQ output voltagendash 32767 01111111 11111111 7FFF Vmaxndash 1 00000000 00000001 0001ndash 0 00000000 00000000 0000 0 Vndash -1 11111111 11111111 FFFFndash -32768 10000000 00000000 8000 Vmin

raquo Example for Little Endian (byte order)bull 5B F6 00 00 01 01 60 F6 2A 00 01 01 hellip [HEX]

I Q Gate Markers I Q Gate Markers

-2469 0 257 -2464 42 257 hellip [Decimal]

ndash For Big Endian (byte order) referred to as byte swappingF6 5B 00 00 01 01 F6 60 00 2A 01 01 hellip [HEX]

I Q Markers Gate I Q Markers Gate

5B F6

F6 5B

Byte Swapping

Binary Editor

Slide 86MG3700A-E-F-11

Byte Order

bull The little endian or big endian byte order depends on the type of PC processor

raquo Intel and AMD processors use little endianraquo Sun and Motorola processors use big endianraquo The Apple PowerPC processor while big endian oriented also

supports the little endian orderndash 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

bull The byte order describes how the system processor stores integervalues as binary data in memory

raquo 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

raquo The order only becomes important when using binary data as whendownloading data to MG3700A

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 45: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

44

Slide 87MG3700A-E-F-11

Byte Order

bull The LSB and MSB positioning changes with byte orderbull In little endian order the LSB and MSB are next to each other in the

bit sequence

Example of -2469 signed integerraquo Little endian

ndash 5B F6 [HEX] 0 1 0 1 1 0 1 1 1 1 1 1 0 1 1 0 [Binary]

raquo Big endianndash F6 5B [HEX] 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 1 [Binary]

bull Most Significant Bit (MSB) is bit position in binary number with greatest valuebull Least Significant Bit (LSB) is bit position in binary integer determining whether the

number is even or oddndash In 2-byte data the MSB appears in the second byte

LSB MSB

LSBMSB

Slide 88MG3700A-E-F-11

Tworsquos Complement Integers

bull Twos complement is a popular way to represent signed integers by counting backwards in computer The MSB represents the sign of positive and negative values

HEX Binary Decimalbull 09 A5 00001001 10100101 +2569+bull F6 5B 11110110 01011011 -2569

= 1 00000000 00000000 0ndash Ignoring 17th bit (leftmost bit) gives actual answer 0

raquo The decimal value of a twos 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

bull F6 5B 11110110 01011011= -215 + 214 + 213 + 212 + 210 + 29 + 26 + 24 + 23 + 21 + 20 = -2569

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 46: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

45

Slide 89MG3700A-E-F-11

Tworsquos Complement Integers

bull Calculating tworsquos complementraquo When finding the twos complement of a binary number the bits are

inverted and the value of 1 is added to the resulting value Bit overflow is ignored

ndash Beginning with F6 5B (-2469)11110110 01011011

bull To convert to +2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

00001001 10100100ndash This numeral is the ones complement of the decimal value -2469

bull To obtain the twos complement 1 is added00001001 10100101

ndash Beginning with 09 A5 (+2469)00001001 10100101

bull To convert to -2469 in twos complement notation the bits are inverted 0 becomes 1 and 1 becomes 0

11110110 01011010bull To obtain the twos complement 1 is added

11110110 01011011

Slide 90MG3700A-E-F-11

MakeWvFile Error

bull An error code is returned when an error occursbull Error code

raquo 0successful completion

raquo 16File writing failure

raquo 23Converting failure due to irregular Pattern Name in parameter text file

raquo 24Converting failure due to irregular Package name in parameter text file

raquo 25Converting failure due to irregular Sampling Rate in parameter text file

raquo 64WVD file opening failure

raquo 65WVI file opening failure

raquo 66Data binary file opening failure

raquo 67Parameter text file opening failure

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 47: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

46

Slide 91MG3700A-E-F-11

Transfer Programming Example

--- Executes on button press in pushbutton3function pushbutton3_Callback(hObject eventdata handles) hObject handle to pushbutton3 (see GCBO) eventdata reserved - to be defined in a future version of MATLAB handles structure with handles and user data (see GUIDATA)

bull Connect to MG3700A creating FTP objectipaddress = get(handlesedit6 String)username = get(handlesedit7 String)password = get(handlesedit8 String)

f = ftp(ipaddress username password)

Get input strings

Slide 92MG3700A-E-F-11

Transfer Programming Example

bull Check existing package folder or make new package folder in MG3700A HDD

package = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

cd(f hdd0PACKAGE)buff = dir(f package)if length(buff) lt 4

mkdir(f package)end

bull Download WVI and WVD filescd(f package)mput(f [ patname wvi])mput(f [ patname wvd])

close(f)

Get input strings

Change directory in MG3700A HDD

Directory listing

Make new directory

Close FTP object

Upload files

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 48: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

47

Slide 93MG3700A-E-F-11

Play Programming Example

--- Executes on button press in pushbutton4function 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)

bull Create TCPIP objectipaddress = get(handlesedit6 String)t = tcpip(ipaddress 49153)fopen(t)

Get input strings

Connect TCPIP object to MG3700AInstrument Control Toolbox

Slide 94MG3700A-E-F-11

Play Programming Example

bull Load pattern data to baseband memorypackage = get(handlesedit9 String)patname = get(handlesedit2 String)if isempty(package)

package = Convert_IQproducerend

fprintf(t [LDFILE WMA package patname ])

for n = 1150pause(1)fprintf(t ESR2)flag = str2num(fscanf(t))if bitget(flag 5) == 1

breakend

end

bull Play back signal patternfprintf(t PATCOMBMODE DEFINED)fprintf(t [LOADEDFILESEL WMA package patname ])fprintf(t OPC)fscanf(t)

fclose(t)delete(t)

Get input strings

Disconnect TCPIP object

Monitor END Event Status Register

Pattern Combination Mode Defined

Operation Complete Query

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 49: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

48

Slide 95MG3700A-E-F-11

Available Sample Programs

Sample programs are available to self-customize them easilyraquo Anritsu_SG_demom

ndash M-file to run on MATLABraquo convandtranstoolm

ndash M-file function called from within Anritsu_SG_demomraquo convandtranstoolfig

ndash GUI layout saved by GUIDEraquo MakeWvFileexe

ndash Executable file to convert a data file into Anritsu VSG formatraquo MG37WP06dll

ndash DLL file called from within MakeWvFileexe

bull Embedded object contains the above five filesraquo MATLAB_ProgrammedSamples2008zzz (100 KB)

ndash Change the file name into MATLAB_ProgrammedSamples2008zip after saving the embedded file

Anritsu_SG_demom

clear all close all clc1313select modulation type13modulation_select = 513 1 16QAM13 2 64QAM13 3 8PSK13 4 QPSK13 5 pi4 shift QPSK1313 initial setting13Fd = 1 symbol rate(fixed) brvbarnormalized to 1(Hz)13Fs = 10Fd sampling rate on simulation13R = 05 roll off of nyquist filter13Delay = 5 delay of roll off filter13Pd = 256 the number of symbol on simulation13Iteration = 2 Iterration (fixed)13t_m = 0PdIteration-1 message data length13t_s = Delay1Fs(Pd+Delay)Fd-1Fs simulation data length13filename = No6_QPSKtxt output filename131313switch modulation_select13 case 1 16-QAM13 M = 16 mapping for QAM 13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 2 64-QAM13 M = 64 mapping for QAM13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = qammod(msg_dM)1313 case 3 8-PSK13 M = 8 mapping of PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dM)1313 case 4 QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a = pskmod(msg_dMpi4)1313 case 5 pi4 shift QPSK13 M = 4 mapping for PSK13 13 generate data13 msg_dd = randint(Pd1M) generate Pd of data13 msg_d = repmat(msg_ddIteration1) Iteration13 13 mapping13 msg_a_temp = pskmod(msg_dMpi4)13 n = [0length(msg_a_temp)-1]13 msg_a = msg_a_temp exp(ipi4n)13 clear msg_a_temp1313 otherwise13 error(modulation type error)13end131313 filtering13rcv_aa = rcosflt(msg_aFdFsfirnormalRDelay)1313 correct filter delay13rcv_a = rcv_aa(FsDelay2+1end-Fs((Pd-Delay)+Delay))1313 output to file13I_Q = [real(rcv_a) imag(rcv_a)]1313rcv_a = I_Q(1) + iI_Q(2)1313 compare signal before and after filter13figure13subplot(211) plot in-phase data13stem(t_mreal(msg_a)) hold on13plot(t_sreal(rcv_a)r)13axis([-1 PdIteration+1 round(min(real(msg_a))) round(max(real(msg_a)))]) grid13title(I-Signal)13xlabel(Sample) ylabel(Amplitude)1313subplot(212) plot quad-phase data13stem(t_mimag(msg_a)) hold on13plot(t_simag(rcv_a)r)13axis([-1 PdIteration+1 round(min(imag(msg_a))) round(max(imag(msg_a)))]) grid13title(Q-Signal)13xlabel(Sample) ylabel(Phase)1313 plot eye pattern13eyediagram(rcv_aFs)1313scatterplot(rcv_a10b-)13hold on13plot(rcv_a(1FsFdend)bo)grid13hold off1313RMSvalue = sqrt(sum(I_Q(1)^2 + I_Q(2)^2)(2length(I_Q)))13I_Q = round(I_Q1634RMSvalue) To integer1313marker1 = [ ones(101) zeros(length(I_Q)-101) ]13marker2 = zeros(length(I_Q)1)13marker3 = zeros(length(I_Q)1)13gate = ones(length(I_Q)1) RF gate flag13marker_gate = marker32^10 + marker22^9 + marker12^8 + gate2^013data = [I_Q marker_gate]1313convandtranstool

convandtranstoolfig

hgS_070000[1x1 struct array]

  • [1x6 char array]
  • [1x1 double array]
  • [1x1 struct array]
    • = Units [1x10 char array]PaperUnits [1x11 char array]Color [1x3 double array]Colormap [64x3 double array]FileName [1x73 char array]IntegerHandle [1x3 char array]InvertHardcopy [1x2 char array]MenuBar [1x4 char array]Name [1x16 char array]NumberTitle [1x3 char array]PaperPosition [1x4 double array]PaperSize [1x2 double array]PaperType [1x2 char array]Position [1x4 double array]Resize [1x3 char array]HandleVisibility [1x8 char array]Tag [1x7 char array]UserData [1x0 double array]ApplicationData [1x1 struct array]Behavior [1x1 struct array]
      • [2x1 struct array]
        • = 2x1 struct array with fields typehandlepropertieschildrenspecial
          • [0x0 double array]
            • convandtranstoolm

              function varargout = convandtranstool(varargin)13 CONVANDTRANSTOOL M-file for convandtranstoolfig13 CONVANDTRANSTOOL by itself creates a new CONVANDTRANSTOOL or raises the existing13 singleton1313 H = CONVANDTRANSTOOL returns the handle to a new CONVANDTRANSTOOL or the handle to13 the existing singleton1313 CONVANDTRANSTOOL(CALLBACKhObjecteventDatahandles) calls the local13 function named CALLBACK in CONVANDTRANSTOOLM with the given input arguments1313 CONVANDTRANSTOOL(PropertyValue) creates a new CONVANDTRANSTOOL or raises the13 existing singleton Starting from the left property value pairs are13 applied to the GUI before convandtranstool_OpeningFunction gets called An13 unrecognized property name or invalid value makes property application13 stop All inputs are passed to convandtranstool_OpeningFcn via varargin1313 See GUI Options on GUIDEs Tools menu Choose GUI allows only one13 instance to run (singleton)1313 See also GUIDE GUIDATA GUIHANDLES1313 Edit the above text to modify the response to help convandtranstool1313 Last Modified by GUIDE v25 12-Oct-2005 1105031313 Begin initialization code - DO NOT EDIT13gui_Singleton = 113gui_State = struct(gui_Name mfilename 13 gui_Singleton gui_Singleton 13 gui_OpeningFcn convandtranstool_OpeningFcn 13 gui_OutputFcn convandtranstool_OutputFcn 13 gui_LayoutFcn [] 13 gui_Callback [])13if nargin ampamp ischar(varargin1)13 gui_Stategui_Callback = str2func(varargin1)13end1313if nargout13 [varargout1nargout] = gui_mainfcn(gui_State varargin)13else13 gui_mainfcn(gui_State varargin)13end13 End initialization code - DO NOT EDIT131313 --- Executes just before convandtranstool is made visible13function convandtranstool_OpeningFcn(hObject eventdata handles varargin)13 This function has no output args see OutputFcn13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)13 varargin command line arguments to convandtranstool (see VARARGIN)1313 Choose default command line output for convandtranstool13handlesoutput = hObject1313 Update handles structure13guidata(hObject handles)1313 UIWAIT makes convandtranstool wait for user response (see UIRESUME)13 uiwait(handlesfigure1)131313 --- Outputs from this function are returned to the command line13function varargout = convandtranstool_OutputFcn(hObject eventdata handles) 13 varargout cell array for returning output args (see VARARGOUT)13 hObject handle to figure13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get default command line output from handles structure13varargout1 = handlesoutput13131313function edit1_Callback(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit1 as text13 str2double(get(hObjectString)) returns contents of edit1 as a double131313 --- Executes during object creation after setting all properties13function edit1_CreateFcn(hObject eventdata handles)13 hObject handle to edit1 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit2_Callback(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit2 as text13 str2double(get(hObjectString)) returns contents of edit2 as a double131313 --- Executes during object creation after setting all properties13function edit2_CreateFcn(hObject eventdata handles)13 hObject handle to edit2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit3_Callback(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit3 as text13 str2double(get(hObjectString)) returns contents of edit3 as a double131313 --- Executes during object creation after setting all properties13function edit3_CreateFcn(hObject eventdata handles)13 hObject handle to edit3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit4_Callback(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit4 as text13 str2double(get(hObjectString)) returns contents of edit4 as a double131313 --- Executes during object creation after setting all properties13function edit4_CreateFcn(hObject eventdata handles)13 hObject handle to edit4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit5_Callback(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit5 as text13 str2double(get(hObjectString)) returns contents of edit5 as a double131313 --- Executes during object creation after setting all properties13function edit5_CreateFcn(hObject eventdata handles)13 hObject handle to edit5 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton213function pushbutton2_Callback(hObject eventdata handles)13 hObject handle to pushbutton2 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Get input string13valname = get(handlesedit1 String)13package = get(handlesedit9 String)13patname = get(handlesedit2 String)13samprate = get(handlesedit10 String)13rmsval = get(handlesedit3 String)13oversamp = get(handlesedit4 String)13sysunit = get(handlesedit5 String)13framelen = get(handlesedit11 String)1313if isempty(package)13 package = Convert_IQproducer13end1313if isempty(valname) | isempty(patname) | isempty(samprate)13 errordlg(Variable NameAPattern NameASampling Rate are necessary)13 return13end1313 generate parameter file13fid = fopen(wave_infodat w)13fprintf(fid [Wave Info]n)13fprintf(fid Soft Type = MX3700n) If using for MG370013 fprintf(fid Soft Type = MX2690n) If using for MS269013fprintf(fid [Package = package n])13fprintf(fid [Pattern Name = patname n])13fprintf(fid [Sampling Rate = samprate Hzn])1313if ~isempty(oversamp)13 fprintf(fid [Over Sampling = oversamp n])13end1313if ~isempty(sysunit)13 fprintf(fid [System Unit = sysunit n])13end1313if ~isempty(framelen)13 fprintf(fid [Frame Length = framelen n])13end1313if ~isempty(rmsval)13 fprintf(fid [WVI RMS Value = rmsval n])13 fprintf(fid [WVD RMS Value = rmsval n])13end1313fprintf(fid Marker1 = Headn)13fprintf(fid Marker2 = n)13fprintf(fid Marker3 = n)1313 Define the following parameters in case of burst signal13fprintf(fid [Rf Gate]n)13fprintf(fid Rf On Off Threshold = 1n)13fprintf(fid Min Rf Gate Length = 100samplesn)1313fclose(fid)1313 generate binary file13try13 evalin(base fid_r = fopen(wave_rawdat w))13 evalin(base [fwrite(fid_r valname int16)])13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)1313catch13 errordlg(assigned figures are incorrect)13 evalin(base fclose(fid_r))13 evalin(base clear fid_r)13 return13end1313 generate wviAwvd files13MakeWvFile wave_infodat wave_rawdat13delete(wave_infodat)13delete(wave_rawdat)1313msgbox(files can be generated)1313function edit9_Callback(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit9 as text13 str2double(get(hObjectString)) returns contents of edit9 as a double131313 --- Executes during object creation after setting all properties13function edit9_CreateFcn(hObject eventdata handles)13 hObject handle to edit9 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit10_Callback(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit10 as text13 str2double(get(hObjectString)) returns contents of edit10 as a double131313 --- Executes during object creation after setting all properties13function edit10_CreateFcn(hObject eventdata handles)13 hObject handle to edit10 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit6_Callback(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit6 as text13 str2double(get(hObjectString)) returns contents of edit6 as a double131313 --- Executes during object creation after setting all properties13function edit6_CreateFcn(hObject eventdata handles)13 hObject handle to edit6 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit7_Callback(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit7 as text13 str2double(get(hObjectString)) returns contents of edit7 as a double131313 --- Executes during object creation after setting all properties13function edit7_CreateFcn(hObject eventdata handles)13 hObject handle to edit7 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end13131313function edit8_Callback(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit8 as text13 str2double(get(hObjectString)) returns contents of edit8 as a double131313 --- Executes during object creation after setting all properties13function edit8_CreateFcn(hObject eventdata handles)13 hObject handle to edit8 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313 --- Executes on button press in pushbutton313function pushbutton3_Callback(hObject eventdata handles)13 hObject handle to pushbutton3 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13username = get(handlesedit7 String)13password = get(handlesedit8 String)1313try13 f = ftp(ipaddress username password)13catch13 errordlg(impossible to connect to MG3700A)13 return13end1313 check existence folder andor generate folder13cd(f hdd0PACKAGE)13buff = dir(f package)13if length(buff) lt 413 mkdir(f package)13end1313 transfer wviAwvd files13try13 cd(f package)13 mput(f [ patname wvi])13 mput(f [ patname wvd])13catch13 errordlg(abnormal termination)13 close(f)13 return13end1313close(f)13msgbox(files can be tranfered normally)1313 --- Executes on button press in pushbutton413function pushbutton4_Callback(hObject eventdata handles)13 hObject handle to pushbutton4 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313package = get(handlesedit9 String)13patname = get(handlesedit2 String)1313if isempty(package)13 package = Convert_IQproducer13end1313ipaddress = get(handlesedit6 String)13t = tcpip(ipaddress 49153)1313try13 fopen(t)13catch13 errordlg(unable to find MG3700A)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])13msg = fscanf(t)13msg = msg(1end-1)1313 transfer to memory from HDD13switch msg13 case ENABLE13 case EXIST13 button = questdlg(Overwrite OK Yes No No)13 if strcmp(button No)13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13 end13 otherwise13 errordlg(transfer to the memory is abnormally terminated)13 delete(t)13 return13end1313fprintf(t [LDFILE WMA package patname ])1313 wait loop for transfer termination(5bitj13for n = 115013 pause(1)13 fprintf(t ESR2)13 flag = str2num(fscanf(t))13 if bitget(flag 5) == 113 break13 end13end1313if n == 15013 errordlg(transfer was abnormally terminated)13 delete(t)13 return13end1313fprintf(t PATCOMBMODE DEFINED)13fprintf(t [LOADEDFILESEL WMA package patname ])13fprintf(t OPC)13fscanf(t)1313fclose(t)13delete(t)1313msgbox(transfer was abnormally terminated)1313function edit11_Callback(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles structure with handles and user data (see GUIDATA)1313 Hints get(hObjectString) returns contents of edit11 as text13 str2double(get(hObjectString)) returns contents of edit11 as a double131313 --- Executes during object creation after setting all properties13function edit11_CreateFcn(hObject eventdata handles)13 hObject handle to edit11 (see GCBO)13 eventdata reserved - to be defined in a future version of MATLAB13 handles empty - handles not created until after all CreateFcns called1313 Hint edit controls usually have a white background on Windows13 See ISPC and COMPUTER13if ispc ampamp isequal(get(hObjectBackgroundColor) get(0defaultUicontrolBackgroundColor))13 set(hObjectBackgroundColorwhite)13end131313

              MakeWvFileexe

              MG37WP06dll

              a1184484
              MATLAB_ProgrammedSamples2008zzz

              Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

              bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

              bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

              bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

              bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

              bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

              bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

              bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

              bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

              bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

              bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

              bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

              bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

              bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

              bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

              bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

              bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

              bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

              bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

              bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

              bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

              Specifications are subject to change without notice

              Please Contact

              071001

              No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD

Page 50: Application Note MATLAB A pplicationdl.cdn-anritsu.com/.../MG3700A_EF11302.pdf• The example uses MATLAB, and shows the programmable M-files. » M-file: MATLAB program for command

Anritsu Corporation 5-1-1 Onna Atsugi-shi Kanagawa 243-8555 JapanPhone +81-46-223-1111Fax +81-46-296-1264

bull USAAnritsu Company1155 East Collins Blvd Suite 100 Richardson TX 75081 USAToll Free 1-800-267-4878Phone +1-972-644-1777Fax +1-972-671-1877

bull CanadaAnritsu Electronics Ltd700 Silver Seven Road Suite 120 Kanata Ontario K2V 1C3 CanadaPhone +1-613-591-2003 Fax +1-613-591-1006

bull Brazil Anritsu Eletrocircnica LtdaPraca Amadeu Amaral 27 - 1 Andar01327-010-Paraiso-Satildeo Paulo-BrazilPhone +55-11-3283-2511Fax +55-11-3288-6940

bull Mexico Anritsu Company SA de CVAv Ejeacutercito Nacional No 579 Piso 9 Col Granada11520 Meacutexico DF MeacutexicoPhone +52-55-1101-2370Fax +52-55-5254-3147

bull UKAnritsu EMEA Ltd200 Capability Green Luton Bedfordshire LU1 3LU UKPhone +44-1582-433200 Fax +44-1582-731303

bull FranceAnritsu SA1618 avenue du Queacutebec-SILIC 72091961 COURTABOEUF CEDEX FrancePhone +33-1-60-92-15-50Fax +33-1-64-46-10-65

bull GermanyAnritsu GmbHNemetschek Haus Konrad-Zuse-Platz 1 81829 Muumlnchen Germany Phone +49-89-442308-0 Fax +49-89-442308-55

bull ItalyAnritsu SpAVia Elio Vittorini 129 00144 Roma ItalyPhone +39-6-509-9711 Fax +39-6-502-2425

bull SwedenAnritsu ABBorgafjordsgatan 13 164 40 KISTA SwedenPhone +46-8-534-707-00 Fax +46-8-534-707-30

bull FinlandAnritsu ABTeknobulevardi 3-5 FI-01530 VANTAA FinlandPhone +358-20-741-8100Fax +358-20-741-8111

bull DenmarkAnritsu ASKirkebjerg Alleacute 90 DK-2605 Broslashndby DenmarkPhone +45-72112200Fax +45-72112210

bull SpainAnritsu EMEA Ltd Oficina de Representacioacuten en EspantildeaEdificio VeganovaAvda de la Vega n˚ 1 (edf 8 pl 1 of 8)28108 ALCOBENDAS - Madrid SpainPhone +34-914905761Fax +34-914905762

bull United Arab EmiratesAnritsu EMEA LtdDubai Liaison OfficeP O Box 500413 - Dubai Internet CityAl Thuraya Building Tower 1 Suit 701 7th FloorDubai United Arab EmiratesPhone +971-4-3670352Fax +971-4-3688460

bull SingaporeAnritsu Pte Ltd60 Alexandra Terrace 02-08 The Comtech (Lobby A)Singapore 118502Phone +65-6282-2400Fax +65-6282-2533

bull IndiaAnritsu Pte Ltd India Branch OfficeUnit No S-3 Second Floor Esteem Red Cross Bhavan No 26 Race Course Road Bangalore 560 001 IndiaPhone +91-80-32944707Fax +91-80-22356648

bull PR China (Hong Kong)Anritsu Company LtdUnits 4 amp 5 28th Floor Greenfield Tower Concordia Plaza No 1 Science Museum Road Tsim Sha Tsui East Kowloon Hong KongPhone +852-2301-4980Fax +852-2301-3545

bull PR China (Beijing)Anritsu Company LtdBeijing Representative OfficeRoom 1515 Beijing Fortune Building No 5 Dong-San-Huan Bei Road Chao-Yang District Beijing 10004 PR ChinaPhone +86-10-6590-9230Fax +86-10-6590-9235

bull KoreaAnritsu Corporation Ltd8F Hyunjuk Building 832-41 Yeoksam Dong Kangnam-ku Seoul 135-080 KoreaPhone +82-2-553-6603Fax +82-2-553-6604

bull AustraliaAnritsu Pty LtdUnit 21270 Ferntree Gully Road Notting Hill Victoria 3168 AustraliaPhone +61-3-9558-8177Fax +61-3-9558-8255

bull TaiwanAnritsu Company Inc7F No 316 Sec 1 Neihu Rd Taipei 114 TaiwanPhone +886-2-8751-1816Fax +886-2-8751-1817

Specifications are subject to change without notice

Please Contact

071001

No MG3700A-E-F-11-(300) Printed in Japan 2008-1 AKD