0% found this document useful (0 votes)
523 views32 pages

MATLAB-Simulink-Fading Channels PDF

Rayleigh and Rician fading channels are useful models of realworld phenomena. They include multipath scattering effects, time dispersion, and Doppler shifts. Each major path behaves as a discrete fading path. Channel for which N = 1 is called a frequencyflat fading channel.

Uploaded by

minhthangbk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
523 views32 pages

MATLAB-Simulink-Fading Channels PDF

Rayleigh and Rician fading channels are useful models of realworld phenomena. They include multipath scattering effects, time dispersion, and Doppler shifts. Each major path behaves as a discrete fading path. Channel for which N = 1 is called a frequencyflat fading channel.

Uploaded by

minhthangbk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

FadingChannels

Onthispage

OverviewofFadingChannels
MethodologyforSimulatingMultipathFadingChannels:
SpecifyFadingChannels
SpecifyDopplerSpectrumofFadingChannel
ConfigureChannelObjects
UseFadingChannels
RayleighFadingChannel
RicianFadingChannel
AdditionalExamplesUsingFadingChannels

OverviewofFadingChannels
UsingCommunicationsSystemToolboxyoucanimplementfadingchannelsusingobjectsorblocks.
RayleighandRicianfadingchannelsareusefulmodelsofrealworldphenomenainwireless
communications.Thesephenomenaincludemultipathscatteringeffects,timedispersion,andDopplershifts
thatarisefromrelativemotionbetweenthetransmitterandreceiver.Thissectiongivesabriefoverviewof
fadingchannelsanddescribeshowtoimplementthemusingthetoolbox.
Thefigurebelowdepictsdirectandmajorreflectedpathsbetweenastationaryradiotransmitteranda
movingreceiver.Theshadedshapesrepresentreflectorssuchasbuildings.

Themajorpathsresultinthearrivalofdelayedversionsofthesignalatthereceiver.Inaddition,theradio
signalundergoesscatteringonalocalscaleforeachmajorpath.Suchlocalscatteringistypically
characterizedbyalargenumberofreflectionsbyobjectsnearthemobile.Theseirresolvablecomponents
combineatthereceiverandgiverisetothephenomenonknownasmultipathfading.Duetothis
phenomenon,eachmajorpathbehavesasadiscretefadingpath.Typically,thefadingprocessis
characterizedbyaRayleighdistributionforanonlineofsightpathandaRiciandistributionforalineofsight
path.
TherelativemotionbetweenthetransmitterandreceivercausesDopplershifts.Localscatteringtypically
comesfrommanyanglesaroundthemobile.ThisscenariocausesarangeofDopplershifts,knownasthe
Dopplerspectrum.ThemaximumDopplershiftcorrespondstothelocalscatteringcomponentswhose
directionexactlyopposesthemobile'strajectory.
ImplementFadingChannelUsinganObject
Abasebandchannelmodelformultipathpropagationscenariosthatyouimplementusingobjectsincludes:

Ndiscretefadingpaths,eachwithitsowndelayandaveragepowergain.AchannelforwhichN=1is
calledafrequencyflatfadingchannel.AchannelforwhichN>1isexperiencedasafrequencyselective
fadingchannelbyasignalofsufficientlywidebandwidth.
ARayleighorRicianmodelforeachpath.
DefaultchannelpathmodelingusingaJakesDopplerspectrum,withamaximumDopplershiftthatcan
bespecified.OthertypesofDopplerspectraallowed(identicalordifferentforallpaths)include:flat,
restrictedJakes,asymmetricalJakes,Gaussian,biGaussian,androunded.
IfthemaximumDopplershiftissetto0oromittedduringtheconstructionofachannelobject,thenthe
objectmodelsthechannelasstatic(i.e.,fadingdoesnotevolvewithtime),andtheDopplerspectrum
specifiedhasnoeffectonthefadingprocess.
SomeadditionalinformationabouttypicalvaluesfordelaysandgainsisinChooseRealisticChannel
PropertyValues
ImplementFadingChannelUsingaBlock
TheChannelsblocklibraryincludesRayleighandRicianfadingblocksthatcansimulaterealworld
phenomenainmobilecommunications.Thesephenomenaincludemultipathscatteringeffects,aswellas
Dopplershiftsthatarisefromrelativemotionbetweenthetransmitterandreceiver.
NoteTomodelachannelthatinvolvesbothfadingandadditivewhiteGaussiannoise,useafading
channelblockconnectedinserieswiththeAWGNChannelblock,wherethefadingchannelblock
comesfirst.

Thetablebelowindicatesthesituationsinwhicheachfadingchannelblockisappropriate.
SignalPath

ChannelBlock

Directlineofsightpathfromtransmittertoreceiver

MultipathRicianFadingChannel

Oneormoremajorreflectedpathsfromtransmitter
toreceiver

MultipathRayleighFadingChannel

Inthecaseofmultiplemajorreflectedpaths,asingleinstanceoftheMultipathRayleighFadingChannel
blockcanmodelallofthemsimultaneously.Thenumberofpathsthattheblockusesisthelengthofeither
theDelayvectorortheGainvectorparameter,whicheverlengthislarger.(Ifbothoftheseparametersare
vectors,theymusthavethesamelengthifexactlyoneoftheseparametersisascalar,theblockexpandsit
intoavectorwhosesizematchesthatoftheothervectorparameter.)
Choosingappropriateblockparametersforyoursituationisimportant.Formoredetailsaboutthe
parametersoffadingchannelblocks,see
ThereferencepagesfortheMultipathRayleighFadingChannelblockandtheMultipathRician
FadingChannelblock
TheChooseRealisticChannelPropertyValuessectionunder"ConfiguringChannelObjects"inthe
CommunicationsSystemToolboxdocumentation
CompensateforFadingResponse
Acommunicationsysteminvolvingafadingchannelusuallyrequirescomponent(s)thatcompensateforthe
fadingresponse.Typicalapproachestocompensateforfadinginclude:

Differentialmodulationoraonetapequalizerhelpscompensateforafrequencyflatfadingchannel.See
theMDPSKModulatorBasebandblockHelppageortheexampleinCompareEmpiricalResultsto
TheoreticalResultsforinformationaboutimplementingdifferentialmodulation.
Anequalizerwithmultipletapshelpscompensateforafrequencyselectivefadingchannel.See
Equalizationformoreinformation.
TheCommunications Link with Adaptive Equalizationexampleillustrateswhycompensatingfora
fadingchannelisnecessary.
VisualizeaFadingChannel
Youcanplotafadingchannel'scharacteristicsusingchannelvisualizationtools.
Forcommunicationsystemsthatyouimplementusingobjects,seeChannelVisualization.
Forcommunicationsystemsthatyouimplementusingblocks,therearetwowaystovisualizefadingchannel
response.Onewayistodoubleclicktheblockduringasimulation.ThesecondwayistoselectOpen
channelvisualizationatstartofsimulationintheblockdialogbox.

MethodologyforSimulatingMultipathFadingChannels:
TheRayleighandRicianmultipathfadingchannelsimulatorsinCommunicationsSystemToolboxusethe
bandlimiteddiscretemultipathchannelmodelofsection9.1.3.5.2in[1].Thisimplementationassumesthat
thedelaypowerprofileandtheDopplerspectrumofthechannelareseparable[1].Themultipathfading

{ }

channelisthereforemodeledasalinearfiniteimpulseresponse(FIR)filter.Let si denotethesetof
{ }
samplesattheinputtothechannel.Thenthesamples yi attheoutputofthechannelarerelatedto

{ }
si through:
N

yi =
{

n=N

singn

where gn isthesetoftapweightsgivenby:

gn =
ak sinc k n, N 1 n N 2
Ts
k=1
K

Intheequationsabove:

Tsistheinputsampleperiodtothechannel.
{ }
k ,where1 k K,isthesetofpathdelays.Kisthetotalnumberofpathsinthemultipathfading
channel.

}
ak ,where1 k K,isthesetofcomplexpathgainsofthemultipathfadingchannel.Thesepath

gainsareuncorrelatedwitheachother.


N 1andN 2arechosensothatgnissmallwhennislessthanN 1orgreaterthanN 2.

Twotechniques,filteredGaussiannoiseandsumofsinusoids,areusedtogeneratethesetofcomplexpath
gains,ak .
Eachpathgainprocessak isgeneratedbythefollowingsteps:
FilteredGaussianNoiseTechnique

1. Acomplexuncorrelated(white)Gaussianprocesswithzeromeanandunitvarianceisgeneratedin
discretetime.
2. ThecomplexGaussianprocessisfilteredbyaDopplerfilterwithfrequencyresponseH (f) =
whereS(f)denotesthedesiredDopplerpowerspectrum.

S(f),

3. ThefilteredcomplexGaussianprocessisinterpolatedsothatitssampleperiodisconsistentwiththatof
theinputsignal.Acombinationoflinearandpolyphaseinterpolationisused.
SumofsinusoidsTechnique
1. MutuallyuncorrelatedRayleighfadingwaveformsaregeneratedusingthemethoddescribedin[2],
wherei=1correspondstotheinphasecomponentandi=2correspondstothequadrature
component.

zk (t) = (1)
(t) + j(2)
(t), k = 1, 2, , K
k
k

(i)
(t)
k

G
=

2
Nk

n=1

(
)
(i)
(i)
cos 2 f k,nt + k,n , i = 1, 2

Where
Nkspecifiesthenumberofsinusoidsusedtomodelasinglepath.

f (i)
isthediscreteDopplerfrequencyandiscalculatedforeachsinusoidcomponentwithinasingle
k,n
path.
(i)
(i)
isthephaseofthenthcomponentofk andisani.i.d.randomvariablehavingauniform
k,n
(
]
distributionovertheinterval 0, 2 .

tisthefadingprocesstime.
(i)

ThediscreteDopplerfrequencies, f k,n,withmaximumshiftfmaxaregivenby

f (i)
k,n

where

(
)
(i)
= f max cos k,n

(
)
1

= f max cos
n
+ (i)
k,0
2N k
2

( )i1
k
(i)
1

, i = 1, 2 and k = 1, 2, , K
k,0
4N k K + 2
2. Inordertoadvancethefadingprocessintime,aninitialtimeparameter,tinit,isintroduced.Thefading
waveformsbecome

(i)
(t)
k

G
=

2
Nk

n=1

(
)
(
)
(i)
(i)
cos 2 f k,n t + t init + k,n , i = 1, 2

Whentinit=0,thefadingprocessstartsattimezero.Apositivevalueoftinitadvancesthefading
processrelativetotimezerowhilemaintainingitscontinuity.
3. ChannelfadingsamplesaregeneratedusingtheGMEDS1[2]algorithm.
CalculateComplexCoefficients

Thecomplexprocessresultingfromeithertechnique,zk ,isscaledtoobtainthecorrectaveragepathgain.
InthecaseofaRayleighchannel,thefadingprocessisobtainedas:

ak =

G
k z k

where

[
]
2
k = E ak

InthecaseofaRicianchannel,thefadingprocessisobtainedas:

(
)

zk
G
K r,k
j 2 f
t+

d,LOS,k LOS,k

ak = k G
+
e
K r,k + 1
K r,k + 1

whereK r,kistheRicianKfactorofthekthpath, f d,LOS,kistheDopplershiftofthelineofsight

componentofthekthpath(inHz),andLOS,kistheinitialphaseofthelineofsightcomponentofthekth
path(inrad).

Attheinputtothebandlimitedmultipathchannelmodel,thetransmittedsymbolsmustbeoversampledbya
factoratleastequaltothebandwidthexpansionfactorintroducedbypulseshaping.Forexample,ifsinc
pulseshapingisused,forwhichthebandwidthofthepulseshapedsignalisequaltothesymbolrate,then
thebandwidthexpansionfactoris1,andatleastonesamplepersymbolisrequiredattheinputtothe
channel.Ifaraisedcosine(RC)filterwithafactorinexcessof1isused,forwhichthebandwidthofthe
pulseshapedsignalisequaltotwicethesymbolrate,thenthebandwidthexpansionfactoris2,andatleast
twosamplespersymbolarerequiredattheinputtothechannel.
Foradditionalinformation,seethearticleAMatlabbasedObjectOrientedApproachtoMultipath
FadingChannelSimulation(http://www.mathworks.com/matlabcentral/fileexchange/18869amatlab
basedobjectorientedapproachtomultipathfadingchannelsimulation),locatedon
MATLABCentral.
References
[1]Jeruchim,M.C.,Balaban,P.,andShanmugan,K.S.,SimulationofCommunicationSystems,Second
Edition,NewYork,KluwerAcademic/Plenum,2000.
[2]Ptzold,Matthias,ChengXiangWang,andBjornOlavHogstand."TwoNewSumofSinusoidsBased
MethodsfortheEfficientGenerationofMultipleUncorrelatedRayleighFadingWaveforms."IEEE
TransactionsonWirelessCommunications.Vol.8,Number6,2009,pp.31223131.

SpecifyFadingChannels
CommunicationsSystemToolboxmodelsafadingchannelasalinearFIRfilter.Filteringasignalusinga
fadingchannelinvolvesthesesteps:
1. Createachannelobjectthatdescribesthechannelthatyouwanttouse.Achannelobjectisatypeof
MATLABvariablethatcontainsinformationaboutthechannel,suchasthemaximumDopplershift.
2. Adjustpropertiesofthechannelobject,ifnecessary,totailorittoyourneeds.Forexample,youcan
changethepathdelaysoraveragepathgains.
Note:Settingthemaximumpathdelaygreaterthan100samplesmaygenerateanOutof
memory'error.

3. Applythechannelobjecttoyoursignalusingthefilterfunction.
Thissectiondescribeshowtodefine,inspect,andmanipulatechannelobjects.Thetopicsare:
CreatingChannelObjects
DisplayObjectProperties
ChangeObjectProperties
RelationshipsAmongChannelObjectProperties
CreatingChannelObjects
Therayleighchanandricianchanfunctionscreatefadingchannelobjects.Thetablebelowindicatesthe
situationsinwhicheachfunctionissuitable.
Function

Object

SituationModeled

rayleighchan

Rayleighfadingchannelobject

Oneormoremajorreflectedpaths

ricianchan

Ricianfadingchannelobject

Onedirectlineofsightpath,
possiblycombinedwithoneor
moremajorreflectedpaths

Forexample,thecommandbelowcreatesachannelobjectrepresentingaRayleighfadingchannelthatacts
onasignalsampledat100,000Hz.ThemaximumDopplershiftofthechannelis130Hz.

c1 = rayleighchan(1/100000,130); % Rayleigh fading channel


object
Theobjectc1isavalidinputargumentforthefilterfunction.Tolearnhowtousethefilterfunctionto
filterasignalusingachannelobject,seeUseFadingChannels.
DuplicateandCopyObjects.Anotherwaytocreateanobjectistoduplicateanexistingobjectandthen
adjustthepropertiesofthenewobject,ifnecessary.Ifyoudothis,itisimportanttouseacopycommand
suchas

c2 = copy(c1); % Copy c1 to create an independent c2.


insteadofc2 = c1.Thecopycommandcreatesacopyofc1thatisindependentofc1.Bycontrast,the
commandc2 = c1createsc2asmerelyareferencetoc1,sothatc1andc2alwayshaveindistinguishable
content.
DisplayObjectProperties
Achannelobjecthasnumerouspropertiesthatrecordinformationaboutthechannelmodel,aboutthestate
ofachannelthathasalreadyfilteredasignal,andaboutthechannel'soperationonafuturesignal.Youcan
viewthepropertiesintheseways:
Toviewallpropertiesofachannelobject,entertheobject'snameintheCommandWindow.
Toviewaspecificpropertyofachannelobjectortoassigntheproperty'svaluetoavariable,enterthe
object'snamefollowedbyadot(period),followedbythenameoftheproperty.
Intheexamplebelow,enteringc1causesMATLABtodisplayallpropertiesofthechannelobjectc1.Some
ofthepropertieshavevaluesfromtherayleighchancommandthatcreatedc1,whileotherpropertieshave
defaultvalues.

c1 = rayleighchan(1/100000,130); % Create object.

c1 % View all properties of c1.


g = c1.PathGains % Retrieve the PathGains property of c1.
Theoutputis

c1 =
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-005
DopplerSpectrum: [1x1 doppler.jakes]
MaxDopplerShift: 130
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: -0.0428 + 0.4732i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
g=
-0.0428 + 0.4732i
ARicianfadingchannelobjecthasanadditionalpropertythatdoesnotappearabove,namely,ascalar
KFactorproperty.
Formoreinformationaboutwhateachchannelpropertymeans,seethereferencepageforthe
rayleighchanorricianchanfunction.
ChangeObjectProperties
Tochangethevalueofawriteablepropertyofachannelobject,issueanassignmentstatementthatuses
dotnotationonthechannelobject.Morespecifically,dotnotationmeansanexpressionthatconsistsofthe
object'sname,followedbyadot,followedbythenameoftheproperty.
TheexamplebelowillustrateshowtochangetheResetBeforeFilteringproperty,indicatingyoudonot
wanttoresetthechannelbeforeeachfilteringoperation.

c1 = rayleighchan(1/100000,130) % Create object.


c1.ResetBeforeFiltering = 0 % Do not reset before filtering.
Theoutputbelowdisplaysallthepropertiesofthechannelobjectbeforeandafterthechangeinthevalueof
theResetBeforeFilteringproperty.Inthesecondlistingofproperties,theResetBeforeFiltering
propertyhasthevalue0.

c1 =

ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-005
DopplerSpectrum: [1x1 doppler.jakes]
MaxDopplerShift: 130
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: 0.5781 + 0.9020i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
c1 =
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-005
DopplerSpectrum: [1x1 doppler.jakes]
MaxDopplerShift: 130
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: 0.5781 + 0.9020i
ChannelFilterDelay: 0
ResetBeforeFiltering: 0
NumSamplesProcessed: 0
Note:Somepropertiesofachannelobjectarereadonly.Forexample,youcannotassignanew
valuetotheNumSamplesProcessedpropertybecausethechannelautomaticallycountsthenumberof
samplesithasprocessedsincethelastreset.

RelationshipsAmongChannelObjectProperties
Somepropertiesofachannelobjectarerelatedtoeachothersuchthatwhenoneproperty'svaluechanges,
anotherproperty'svaluemustchangeinsomecorrespondingwaytokeepthechannelobjectconsistent.For
example,ifyouchangethevectorlengthofPathDelays,thenthevalueofAvgPathGaindBmustchangeso
thatitsvectorlengthequalsthatofthenewvalueofPathDelays.Thisisbecausethelengthofeachofthe
twovectorsequalsthenumberofdiscretepathsofthechannel.Fordetailsaboutlinkedpropertiesandan
example,seethereferencepageforrayleighchanorricianchan.

SpecifyDopplerSpectrumofFadingChannel
TheDopplerspectrumofachannelobjectisspecifiedthroughitsDopplerSpectrumproperty.Thevalueof

thispropertymustbeeither:
ADopplerobject.Inthiscase,thesameDopplerspectrumappliestoeachpathofthechannelobject.
AvectorofDopplerobjectsofthesamelengthasthePathDelaysvectorproperty.Inthiscase,the
DopplerspectrumofeachpathisgivenbythecorrespondingDopplerobjectinthevector.
ADopplerobjectcontainsallthepropertiesusedtocharacterizetheDopplerspectrum,withtheexceptionof
themaximumDopplershift,whichisapropertyofthechannelobject.Thissectiondescribeshowtocreate
andmanipulateDopplerobjects,andhowtoassignthemtotheDopplerSpectrumpropertyofchannel
objects.
CreateaDopplerObject
ThesolepurposeofDopplerobjectsistospecifythevalueoftheDopplerSpectrumpropertyofchannel
objects.Dopplerobjectscanbecreatedusingoneofsevenfunctions:doppler.ajakes,
doppler.bigaussian,doppler.jakes,doppler.rjakes,doppler.flat,doppler.gaussian,and
doppler.rounded.Foradescriptionofeachofthesefunctionsandtheunderlyingtheory,refertotheir
correspondingreferencepages.
Forexample,aGaussianspectrumwithanormalized(bythemaximumDopplershiftofthechannel)
standarddeviationof0.1,canbecreatedas:

d = doppler.gaussian(0.1);
DuplicateDopplerObjects
Asinthecaseofchannelobjects,Dopplerobjectscanbeduplicatedusingthecopyfunction.The
command:

d2 = copy(d1);
createsaDopplerobjectd2withthesamepropertiesasthatofd1.d1andd2arethenseparateinstancesof
aDopplerobject,inthatmodifyingeitheronewillnotaffecttheother.Usingd1 = d2insteadwillcauseboth
d1andd2toreferencethesameinstanceofaDopplerobject,inthatmodifyingeitheronewillcausethe
samemodificationtotheother.
ViewandChangeDopplerObjectProperties
ThesyntaxforviewingandchangingDopplerobjectpropertiesisthesameasforthecaseofchannel
objects(seeDisplayObjectPropertiesandChangeObjectProperties).Thefunctiondispcanbeused
withDopplerobjectstodisplaytheirproperties.
Inthefollowingexample,aroundedDopplerobjectwithdefaultpropertiesiscreatedanddisplayed,andthe
thirdelementofitsCoeffRoundedpropertyismodified:

dr = doppler.rounded
dr =
SpectrumType: 'Rounded'
CoeffRounded: [1 -1.7200 0.7850]
dr.CoeffRounded(3) = 0.8250

dr =
SpectrumType: 'Rounded'
CoeffRounded: [1 -1.7200 0.8250]
NotethatthepropertySpectrumType,whichiscommontoallDopplerobjects,isreadonly.Itis
automaticallyspecifiedatobjectconstruction,andcannotbemodified.IfyouwishtouseadifferentDoppler
spectrumtype,youneedtocreateanewDopplerobjectofthedesiredtype.
UseDopplerObjectsWithinChannelObjects
TheDopplerSpectrumpropertyofachannelobjectcanbechangedbyassigningtoitaDopplerobjectora
vectorofDopplerobjects.ThefollowingexampleillustrateshowtochangethedefaultJakesDoppler
spectrumofaconstructedRayleighchannelobjecttoaflatDopplerspectrum:

>> h = rayleighchan(1/9600, 100)


h=
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0417e-004
DopplerSpectrum: [1x1 doppler.jakes]
MaxDopplerShift: 100
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: -0.4007 - 0.2748i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
>> dop_flat = doppler.flat
dop_flat =
SpectrumType: 'Flat'
>> h.DopplerSpectrum = dop_flat
h=
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0417e-004

DopplerSpectrum: [1x1 doppler.flat]


MaxDopplerShift: 100
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: -0.4121 - 0.2536i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
ThefollowingexampleshowshowtochangethedefaultJakesDopplerspectrumofaconstructedRician
channelobjecttoaGaussianDopplerspectrumwithnormalizedstandarddeviationof0.3,andsubsequently
displaytheDopplerSpectrumproperty,andchangethevalueofthenormalizedstandarddeviationto1.1:

>> h = ricianchan(1/9600, 100, 2);


>> h.DopplerSpectrum = doppler.gaussian(0.3)
h=
ChannelType: 'Rician'
InputSamplePeriod: 1.0417e-004
DopplerSpectrum: [1x1 doppler.gaussian]
MaxDopplerShift: 100
PathDelays: 0
AvgPathGaindB: 0
KFactor: 2
DirectPathDopplerShift: 0
DirectPathInitPhase: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: 0.8073 - 0.0769i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
>> h.DopplerSpectrum
ans =
SpectrumType: 'Gaussian'

SigmaGaussian: 0.3000
>> h.DopplerSpectrum.SigmaGaussian = 1.1;
ThefollowingexampleillustrateshowtochangethedefaultJakesDopplerspectrumofaconstructedthree
pathRayleighchannelobjecttoavectorofdifferentDopplerspectra,andthenchangethepropertiesofthe
Dopplerspectrumofthethirdpath:

>> h = rayleighchan(1/9600, 100, [0 1e-4 2.1e-4]);


>> h.DopplerSpectrum = [doppler.flat doppler.flat
doppler.rounded]
h=
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0417e-004
DopplerSpectrum: [3x1 doppler.baseclass]
MaxDopplerShift: 100
PathDelays: [0 1.0000e-004 2.1000e-004]
AvgPathGaindB: [0 0 0]
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: [0.4233 - 0.1113i -0.0785 + 0.1667i
-0.2064 + 0.3531i]
ChannelFilterDelay: 3
ResetBeforeFiltering: 1
NumSamplesProcessed: 0
>> h.DopplerSpectrum(3).CoeffRounded = [1 -1.21 0.7];
IftheDopplerSpectrumpropertyofachannelobjectisavector:
IfthelengthofthePathDelaysvectorpropertyisincreased,thelengthofDopplerSpectrumis
automaticallyincreasedtomatchthelengthofPathDelays,byappendingJakesDopplerobjects.
IfthelengthofthePathDelaysvectorpropertyisdecreased,thelengthofDopplerSpectrumis
automaticallydecreasedtomatchthelengthofPathDelays,byremovingthelastDopplerobject(s).

ConfigureChannelObjects
Beforeyoufilterasignalusingachannelobject,makesurethatthepropertiesofthechannelhavesuitable
valuesforthesituationyouwanttomodel.Thissectionofferssomeguidelinestohelpyouchooserealistic
valuesthatareappropriateforyourmodelingneeds.Thetopicsare
ChooseRealisticChannelPropertyValues
ConfigureChannelObjectsBasedonSimulationNeeds
ThesyntaxesforviewingandchangingvaluesofpropertiesofchannelobjectsaredescribedinSpecify

FadingChannels.
ChooseRealisticChannelPropertyValues
Herearesometipsforchoosingpropertyvaluesthatdescriberealisticchannels:
PathDelays
Byconvention,thefirstdelayistypicallysettozero.Thefirstdelaycorrespondstothefirstarrivingpath.
Forindoorenvironments,pathdelaysafterthefirstaretypicallybetween1nsand100ns(thatis,
between1e9sand1e7s).
Foroutdoorenvironments,pathdelaysafterthefirstaretypicallybetween100nsand10s(thatis,
between1e7sand1e5s).Verylargedelaysinthisrangemightcorrespond,forexample,toanarea
surroundedbymountains.
Note:Settingthemaximumpathdelaygreaterthan100samplesmaygenerateanOutof
memory'error.

Theabilityofasignaltoresolvediscretepathsisrelatedtoitsbandwidth.Ifthedifferencebetweenthe
largestandsmallestpathdelaysislessthanabout1%ofthesymbolperiod,thenthesignalexperiences
thechannelasifithadonlyonediscretepath.
AveragePathGains
Theaveragepathgainsinthechannelobjectindicatetheaveragepowergainofeachfadingpath.In
practice,anaveragepathgainvalueisalargenegativedBvalue.However,computermodelstypically
useaveragepathgainsbetween20dBand0dB.
ThedBvaluesinavectorofaveragepathgainsoftendecayroughlylinearlyasafunctionofdelay,but
thespecificdelayprofiledependsonthepropagationenvironment.
Toensurethattheexpectedvalueofthepathgains'totalpoweris1,youcannormalizepathgainsvia
thechannelobject'sNormalizePathGainsproperty.
MaximumDopplerShifts
Somewirelessapplications,suchasstandardGSM(GlobalSystemforMobileCommunication)
systems,prefertospecifyDopplershiftsintermsofthespeedofthemobile.Ifthemobilemovesat
speedv(m/s),thenthemaximumDopplershiftiscalculatedasfollows,wherefisthetransmission
carrierfrequencyinHertzandcisthespeedoflight(3e8m/s).

fd =

vf
c

Basedonthisformulaintermsofthespeedofthemobile,asignalfromamovingcaronafreewaymight
experienceamaximumDopplershiftofabout80Hz,whileasignalfromamovingpedestrianmight
experienceamaximumDopplershiftofabout4Hz.Thesefiguresassumeatransmissioncarrier
frequencyof900MHz.
AmaximumDopplershiftof0correspondstoastaticchannelthatcomesfromaRayleighorRician
distribution.
KFactorforRicianFadingChannels

TheRicianKfactorspecifiestheratioofspeculartodiffusepowerforadirectlineofsightpath.The
ratioisexpressedlinearly,notindB.
ForRicianfading,theKfactoristypicallybetween1and10.
AKfactorof0correspondstoRayleighfading.
DopplerSpectrumParameters
SeethereferencepagesfortherespectiveDopplerobjectsfordescriptionsoftheparametersandtheir
significance.
ConfigureChannelObjectsBasedonSimulationNeeds
Herearesometipsforconfiguringachannelobjecttocustomizethefilteringprocess:
Ifyourdataispartitionedintoaseriesofvectors(thatyouprocesswithinaloop,forexample),youcan
invokethefilterfunctionmultipletimeswhileautomaticallysavingthechannel'sstateinformationfor
useinasubsequentinvocation.Thestateinformationisvisibletoyouinthechannelobject'sPathGains
andNumSamplesProcessedproperties,butalsoinvolvespropertiesthatareinternalratherthanvisible.
Note:Tomaintaincontinuityfromoneinvocationtothenext,youmustsetthe
ResetBeforeFilteringpropertyofthechannelobjectto0.

IfyousettheResetBeforeFilteringpropertyofthechannelobjectto0andwanttherandomnessto
berepeatable,usetheresetfunctionbeforefilteringanysignalstoresetboththechannelandthestate
oftheinternalrandomnumbergenerator.
Ifyouwanttoresetthechannelbeforeafilteringoperationsothatitdoesnotuseanypreviouslystored
stateinformation,eitherusetheresetfunctionorsettheResetBeforeFilteringpropertyofthe
channelobjectto1.Theformermethodresetsthechannelobjectonce,whilethelattermethodcauses
thefilterfunctiontoresetthechannelobjecteachtimeyouinvokeit.
Ifyouwanttonormalizethefadingprocesssothattheexpectedvalueofthepathgains'totalpoweris1,
settheNormalizePathGainspropertyofthechannelobjectto1.

UseFadingChannels
AfteryouhavecreatedachannelobjectasdescribedinSpecifyFadingChannels,youcanusethefilter
functiontopassasignalthroughthechannel.Theargumentstofilterarethechannelobjectandthe
signal.Attheendofthefilteringoperation,thechannelobjectretainsitsstatesothatyoucanfindoutthe
finalpathgainsorthetotalnumberofsamplesthatthechannelhasprocessedsinceitwascreatedorreset.
Ifyouconfiguredthechanneltoavoidresettingitsstatebeforeeachnewfilteringoperation
(ResetBeforeFilteringis0),thentheretentionofstateinformationisimportantformaintainingcontinuity
betweensuccessivefilteringoperations.
Foranexamplethatillustratesthebasicsyntaxandstateretention,seePowerofaFadedSignal.
Ifyouwanttousethechannelvisualizationtooltoplotthecharacteristicsofachannelobject,youneedto
settheStateHistorypropertyofthechannelobjectto1sothatitispopulatedwithplotinformation.See
ChannelVisualizationfordetails.

RayleighFadingChannel
Thefollowingexamplesusefadingchannels:

PowerofaFadedSignal
CompareEmpiricalResultstoTheoreticalResults
WorkwithDelays
FilterUsingaLoop
StoreChannelStateHistory
UsetheChannelVisualizationTool
PowerofaFadedSignal
Thecodebelowplotsafadedsignal'spower(versussamplenumber).Thecodealsoillustratesthesyntaxof
thefilterandrayleighchanfunctionsandthestateretentionofthechannelobject.Noticefromthe
outputthatNumSamplesProcessedequalsthenumberofelementsinsig,thesignal.

c = rayleighchan(1/10000,100);
sig = 1i*ones(2000,1); % Generate signal
y = filter(c,sig);
% Pass signal through channel
c
% Display all properties of the channel
% Plot power of faded signal, versus sample number.
plot(20*log10(abs(y)))
Theoutputandtheplotfollow.

c=
ChannelType: 'Rayleigh'
InputSamplePeriod: 1.0000e-004
DopplerSpectrum: [1x1 doppler.jakes]
MaxDopplerShift: 100
PathDelays: 0
AvgPathGaindB: 0
NormalizePathGains: 1
StoreHistory: 0
StorePathGains: 0
PathGains: -0.8062 + 0.2648i
ChannelFilterDelay: 0
ResetBeforeFiltering: 1
NumSamplesProcessed: 2000

CompareEmpiricalResultstoTheoreticalResults
ThecodebelowcreatesafrequencyflatRayleighfadingchannelobjectandusesittoprocessaDBPSK
signalconsistingofasinglevector.Theexamplecontinuesbycomputingthebiterrorrateofthesystemfor
differentvaluesofthesignaltonoiseratio.Noticethattheexampleusesfilterbeforeawgnthisisthe
recommendedsequencetousewhenyoucombinefadingwithAWGN.

% Create Rayleigh fading channel object.


chan = rayleighchan(1/10000,100);
% Generate data and apply fading channel.
M = 2; % DBPSK modulation order
hMod = comm.DBPSKModulator;
% Create a DPSK modulator
hDemod = comm.DBPSKDemodulator;
% Create a DPSK demodulator
tx = randi([0 M-1],50000,1);
% Generate a random bit
stream
dpskSig = step(hMod, tx);
% DPSK modulate the signal
fadedSig = filter(chan,dpskSig);
% Apply the channel effects

% Compute error rate for different values of SNR.


SNR = 0:2:20; % Range of SNR values, in dB.
numSNR = length(SNR);
berVec = zeros(3, numSNR);
% Create an AWGNChannel and ErrorRate calculator System object
hChan = comm.AWGNChannel('NoiseMethod', 'Signal to noise ratio
(SNR)');
hErrorCalc = comm.ErrorRate;
for n = 1:numSNR
hChan.SNR = SNR(n);
rxSig = step(hChan,fadedSig); % Add Gaussian noise
rx = step(hDemod, rxSig); % Demodulate
reset(hErrorCalc)
% Compute error rate.
berVec(:,n) = step(hErrorCalc,tx,rx);
end
BER = berVec(1,:);
% Compute theoretical performance results, for comparison.
BERtheory = berfading(SNR,'dpsk',M,1);
% Plot BER results.
semilogy(SNR,BERtheory,'b-',SNR,BER,'r*');
legend('Theoretical BER','Empirical BER');
xlabel('SNR (dB)'); ylabel('BER');
title('Binary DPSK over Rayleigh Fading Channel');
Withtheparametersintheprecedingcode,thefadingisslowenoughtobeconsideredthesameacrosstwo
consecutivesamples.
Theresultingplotshowsthatthesimulationresultsareclosetothetheoreticalresultscomputedby
berfading.

WorkwithDelays
Thevalueofachannelobject'sChannelFilterDelaypropertyisthenumberofsamplesbywhichthe
outputofthechannellagstheinput.Ifyoucomparetheinputandoutputdatasetsdirectly,youmusttake
thedelayintoaccountbyusingappropriatetruncatingorpaddingoperations.
Theexampleillustratesonewaytoaccountforthedelaybeforecomputingabiterrorrate.

M = 2;
% DQPSK modulation order
bitRate = 50000;
hMod = comm.DBPSKModulator;
% Create a DPSK modulator
hDemod = comm.DBPSKDemodulator;
% Create a DPSK demodulator
% Create Rayleigh fading channel object.
ch = rayleighchan(1/bitRate,4,[0 0.5/bitRate],[0 -10]);
delay = ch.ChannelFilterDelay;
tx = randi([0 M-1],50000,1);
stream
dpskSig = step(hMod,tx);

% Generate random bit


% DPSK modulate signal

fadedSig = filter(ch,dpskSig);
% Apply channel effects
rx = step(hDemod,fadedSig); % Demodulate signal
% Compute bit error rate, taking delay into account.
hErrorCalc = comm.ErrorRate('ReceiveDelay', delay);
berVec = step(hErrorCalc,tx,rx);
ber = berVec(1)
num = berVec(2)
Theoutputbelowshowsthattheerrorrateissmall.Iftheexamplehadnotcompensatedforthechannel
delay,theerrorratewouldhavebeencloseto1/2.

num =
845

ber =
0.0170
FilterUsingaLoop
ThesectionConfigureChannelObjectsBasedonSimulationNeedsindicateshowtoinvokethefilter
functionmultipletimeswhilemaintainingcontinuityfromoneinvocationtothenext.Theexamplebelow
invokesfilterwithinaloopandusesthesmalldatasetsfromsuccessiveiterationstocreateananimated
effect.TheparticularchannelinthisexampleisaRayleighfadingchannelwithtwodiscretemajorpaths.

% Set up parameters.
M = 4;
% QPSK modulation order
hMod = comm.QPSKModulator;
bitRate = 50000;
% Data rate is 50 kb/s
numTrials = 125;
% Number of iterations of loop
% Create Rayleigh fading channel object.
ch = rayleighchan(1/bitRate,4,[0 2e-5],[0 -9]);
% Indicate that FILTER should not reset the channel
% in each iteration below.
ch.ResetBeforeFiltering = 0;
% Initialize scatter plot.
hConst = comm.ConstellationDiagram;
% Apply channel in a loop, maintaining continuity.
% Plot only the current data in each iteration.

for n = 1:numTrials
tx = randi([0 M-1],500,1);
% Generate random bit stream
pskSig = step(hMod,tx);
% PSK modulate signal
fadedSig = filter(ch, pskSig); % Apply channel effects
% Plot the new data from this iteration.
step(hConst,fadedSig);
end
Thescatterplotchangeswitheachiterationoftheloop,andtheexactcontentvariesbecausethefading
processinvolvesrandomnumbers.
StoreChannelStateHistory
Bydefault,thePathGainspropertyofachannelobjectstoresthecurrentcomplexpathgainvector.
SettingtheStoreHistorypropertyofachanneltotruemakesitstorethelastNpathgainvectors,whereN
isthelengthofthevectorprocessedthroughthechannel.Thefollowingcodeillustratesthisproperty

h = rayleighchan(1/100000, 130);
tx = randi([0 1],10,1);
hmod = comm.DBPSKModulator;
dpskSig = step(hmod,tx);
step method
h.StoreHistory = true;
y = filter(h, dpskSig);
h.PathGains
gains data
Thisexamplegeneratesanoutputsimilartothefollowing:

-0.7601 - 1.1853i
-0.7540 - 1.1822i
-0.7480 - 1.1791i
-0.7419 - 1.1759i
-0.7358 - 1.1728i
-0.7298 - 1.1696i
-0.7237 - 1.1665i
-0.7177 - 1.1634i
-0.7115 - 1.1599i
-0.7053 - 1.1565i
ans =
0.0788 - 0.5305i
Thelastelementisthecurrentpathgainofthechannel.

% Rayleigh channel
% Random bit stream
% Create DBPSK Modulator
% Process data by calling the
% Allow states to be stored
% Run signal through channel
% Display the stored path

SettingStoreHistorytotruesignificantlyslowsdowntheexecutionspeedofthechannel'sfilterfunction.
UsetheChannelVisualizationTool
CommunicationsSystemToolboxsoftwareprovidesaplottingfunctionthathelpsyouvisualizethe
characteristicsofafadingchannelusingaGUI.SeeFadingChannelsforadescriptionoffadingchannels
andobjects.
Toopenthechannelvisualizationtool,typeplot(h)atthecommandline,wherehisachannelobjectthat
containsplotinformation.Topopulateachannelobjectwithplotinformation,runasignalthroughitafter
settingitsStoreHistorypropertytotrue.
Forexample,thefollowingcodeopensthechannelvisualizationtoolshowingathreepathRayleighchannel
throughwhicharandomsignalispassed:

% Three-Path Rayleigh channel


h = rayleighchan(1/100000, 130, [0 1.5e-5 3.2e-5], [0, -3,
-3]);
tx = randi([0 1],500,1);
% Random bit stream
hmod = comm.DBPSKModulator;
% Create DBPSKModulator
dpskSig = step(hmod,tx);
% DPSK signal
h.StoreHistory = true;
% Allow states to be stored
y = filter(h, dpskSig);
% Run signal through channel
plot(h);
% Call Channel Visualization
Tool

SeeExamplesofUsingtheChannelVisualizationToolforthebasicusagecasesofthechannel
visualizationtool.
ThistoolcanalsobeaccessedfromCommunicationsSystemToolboxsoftware.
PartsoftheGUI.TheVisualizationpulldownmenuallowsyoutochoosethevisualizationmethod.
TheFramecountcountershowstheindexofthecurrentframe.Itshowsthenumberofframesprocessed
bythefiltermethodsincethechannelobjectwasconstructedorreset.AframeisavectorofMelements,
interpretedtobeMsuccessivesamplesthatareuniformlyspacedintime,withasampleperiodequaltothat
specifiedforthechannel.
TheSampleindexslidercontrolindicateswhichchannelsnapshotiscurrentlybeingdisplayed,whilethe
Pausebuttonpausesarunninganimationuntilyouclickitagain.TheslidercontrolandPausebuttonapply
toallvisualizationsexcepttheDoppler Spectrum.
TheAnimationpulldownmenuallowsyoutoselecthowyouwanttodisplaythechannelsnapshotswithin
eachframe.SettingthistoSlowmakesthetoolshowchannelsnapshotsinsuccession,startingatthe
samplesetbytheSampleindexslidercontrol.SelectingMediumorFastmakesthetoolshowfewer
uniformlyspacedsnapshots,allowingyoutogothroughthechannelsnapshotsmorerapidly.Selecting
Interframe only(thedefaultselection)preventsautomaticanimationofsnapshotswithinthesameframe.
TheAnimationmenuappliestoallvisualizationsexcepttheDoppler Spectrum.
VisualizationOptions.Thechannelvisualizationtoolplotsthecharacteristicsofafilterinvariousways.
SimplychoosethevisualizationmethodfromtheVisualizationmenu,andtheplotupdatesitself
automatically.

Thefollowingvisualizationmethodsarecurrentlyavailable:
ImpulseResponse(IR).
Thisplotshowsthemagnitudesoftwoimpulseresponses:themultipathresponse(infinitebandwidth)and
thebandlimitedchannelresponse.

Themultipathresponseisrepresentedbystems,eachcorrespondingtoonemultipathcomponent.The
componentwiththesmallestdelayvalueisshowninred,andthecomponentwiththelargestdelayvalueis
showninblue.Componentswithintermediatedelayvaluesareshadesbetweenredandblue,becoming
moreblueforlargerdelays.
Thebandlimitedchannelresponseisrepresentedbythegreencurve.Thisresponseistheresultof
convolvingthemultipathimpulseresponse,describedabove,withasincpulseofperiod,T,equaltothe
inputsignal'ssampleperiod.
Thesolidgreencirclesrepresentthechannelfilterresponsesampledatrate1/T.Theoutputofthechannel
filteristheconvolutionoftheinputsignal(sampledatrate1/T)withthisdiscretetimeFIRchannelfilter
response.Forcomputationalspeed,theresponseistruncated.
Thehollowgreencirclesrepresentsamplevaluesnotcapturedinthechannelfilterresponsethatisusedfor
processingtheinputsignal.
Notethattheseimpulseresponsesvaryovertime.Youcanusetheslidertovisualizehowtheimpulse
responsechangesovertimeforthecurrentframe(i.e.,inputsignalvectorovertime).
FrequencyResponse(FR).
Thisplotshowsthemagnitude(indB)ofthefrequencyresponseofthemultipathchanneloverthesignal
bandwidth.

Aswiththeimpulseresponsevisualization,youcanvisualizehowthisfrequencyresponsechangesover
time.
IRWaterfall.
Thisplotshowstheevolutionofthemagnitudeimpulseresponseovertime.

Itshows10snapshotsofthebandlimitedchannelimpulseresponsewithinthelastframe,withthedarkest
greencurveshowingthecurrentresponse.
Thetimeoffsetisthetimeofthechannelsnapshotrelativetothecurrentresponsetime.
PhasorTrajectory.
Thisplotshowsphasors(vectorsrepresentingmagnitudeandphase)foreachmultipathcomponent,using
thesamecolorcodethatwasusedfortheimpulseresponseplot.

Thephasorsareconnectedendtoendinorderofpathdelay,andthetrajectoryoftheresultantphasoris
plottedasagreenline.Thisresultantphasorisreferredtoasthenarrowbandphasor.
Thisplotcanbeusedtodeterminetheimpactofthemultipathchannelonanarrowbandsignal.A
narrowbandsignalisdefinedhereashavingasampleperiodmuchgreaterthanthespanofdelaysofthe
multipathchannel(alternatively,asignalbandwidthmuchsmallerthanthecoherencebandwidthofthe
channel).Thus,themultipathchannelcanberepresentedbyasinglecomplexgain,whichisthesumofall
themultipathcomponentgains.Whenthenarrowbandphasortrajectorypassesthroughorneartheorigin,it
correspondstoadeepnarrowbandfade.
MultipathComponents.
Thisplotshowsthemagnitudesofthemultipathgainsovertime,usingthesamecolorcodeasthatusedfor
themultipathimpulseresponse.

Thetrianglemarkerandverticaldashedlinerepresentthestartofthecurrentframe.Ifaframehasbeen
processedpreviously,itsmultipathgainsmayalsobedisplayed.

MultipathGain.
Thisplotshowsthecollectivegainsforthemultipathchannelforthreesignalbandwidths.

Acollectivegainisthesumofcomponentmagnitudes,asexplainedinthefollowing:
Narrowband(magentadots):Thisisthemagnitudeofthenarrowbandphasorintheabovetrajectory
plot.Thiscurveissometimesreferredtoasthenarrowbandfadingenvelope.
Currentsignalbandwidth(dashedblueline):Thisisthesumofthemagnitudesofthechannelfilter
impulseresponsesamples(thesolidgreendotsintheimpulseresponseplot).Thiscurverepresentsthe
maximumsignalenergythatcanbecapturedusingaRAKEreceiver.Itsvalue(ormetrics,suchas
theoreticalBER,derivedfromit)issometimesreferredtoasthematchedfilterbound.
Infinitebandwidth(solidredline):Thisisthesumofthemagnitudesofthemultipathcomponentgains.
Ingeneral,thevariabilityofthismultipathgain,orofthesignalfading,decreasesassignalbandwidthis
increased,becausemultipathcomponentsbecomemoreresolvable.Ifthesignalbandwidthcurveroughly
followsthenarrowbandcurve,youmightdescribethesignalasnarrowband.Ifthesignalbandwidthcurve
roughlyfollowstheinfinitebandwidthcurve,youmightdescribethesignalaswideband.Withtheright
receiver,awidebandsignalexploitsthepathdiversityinherentinamultipathchannel.
DopplerSpectrum.
ThisplotshowsuptotwoDopplerspectra.

ThefirstDopplerspectrum,representedbythedashedredline,isatheoreticalspectrumbasedonthe
Dopplerfilterresponseusedinthemultipathchannelmodel.Intheprecedingplot,thetheoreticalDoppler
spectrumusedforthemultipathchannelmodelisknownastheJakesspectrum.Notethattheplotted
Dopplerspectrumisnormalizedtohaveatotalpowerof1.ThisDopplerspectrumisusedtodeterminea
Dopplerfilterresponse.Forpracticalpurposes,theDopplerfilterresponseistruncated,whichhastheeffect
ofmodifyingtheDopplerspectrum,asshownintheplot.
ThesecondDopplerspectrum,representedbythebluedots,isdeterminedbymeasuringthepower
spectrumofthemultipathfadingchannelasthemodelgeneratespathgains.Thismeasurementis
meaningfulonlyafterenoughpathgainshavebeengenerated.Thetitleabovetheplotreportshowmany
samplesneedtobeprocessedthroughthechannelbeforeeitherthefirstDopplerspectrumoranupdated
spectrumcanbeplotted.
ThePathNumbereditboxallowsyoutovisualizetheDopplerspectrumofthespecifiedpath.Thevalue
enteredinthisboxmustbeavalidpathnumber,i.e.,between1andthelengthofthePathDelaysvector
property.Onceyouchangethevalueofthisfield,thenewDopplerspectrumwillappearassoonasthe
processingofthecurrentframehasended.
IfthemeasuredDopplerspectrumisagoodapproximationofthetheoreticalDopplerspectrum,the
multipathchannelmodelhasgeneratedenoughfadinggainstoyieldareasonablerepresentationofthe
channelstatistics.Forinstance,ifyouwanttodeterminetheaverageBERofacommunicationslinkwitha
multipathchannelandyouwantastatisticallyaccuratemeasureofthisaverage,youmaywanttoensure
thatthechannelhasprocessedenoughsamplestoyieldatleastoneDopplerspectrummeasurement.
Itispossiblethatamultipathchannel(e.g.,aRicianchannel)canhavebothspecular(lineofsight)and
diffusecomponents.Insuchacase,theDopplerspectrumwouldhavebothalinecomponentanda
widebandcomponent.ThechannelvisualizationtoolonlyshowsthewidebandcomponentfortheDoppler
spectrum.
Unlikeothervisualizations,theDopplerspectrumvisualizationdoesnotsupportanimation.Becausethereis
nointraframedatatoplot,thevisualizationtoolonlyupdatesthechannelstatisticsattheendofeachframe
andthereforecannotpauseinthemiddleofaframe.IfyouswitchtotheDopplerspectrumvisualizationfrom
adifferentvisualizationthatisinpausemode,thePausebuttonissubsequentlydisabled.Disablingpause
avoidsinteractionproblemsbetweentheDopplerspectrumvisualizationandotheranimationstyle
visualizations.

ScatteringFunction.
ThisplotshowstheDopplerspectraofeachpathversusthepathdelays,usingthesamecolorcodeasthat
usedforthemultipathimpulseresponse.

TheprincipleofoperationoftheScatteringFunctionplotissimilartothatoftheDopplerSpectrumplot.The
maindifferenceisthattheDopplerspectraonthisplotarenotnormalizedastheyareontheDoppler
Spectrumplot,inordertobettervisualizethepowerdelayprofile.
CompositePlots.
Severalcompositeplotsarealsoavailable.Thesearechosenbyselectingthefollowingfromthe
Visualizationpulldownmenu:
IR and FRforimpulseresponseandfrequencyresponseplots.
Components and Gainformultipathcomponentsandmultipathgainplots.
Components and IRformultipathcomponentsandimpulseresponseplots.
Components, IR, and Phasorformultipathcomponents,impulseresponse,andphasortrajectory

plots.
ExamplesofUsingtheChannelVisualizationTool.Herearetwoexamplesthatshowhowyoumight
interactwiththeGUI.
VisualizeSamplesWithinaFrame.
Thisexampleshowshowtovisualizesampleswithinaframethroughanimation.Thefollowinglinesofcode
createaRayleighchannelandopenthechannelvisualizationtool:

% Create a fast fading channel


h = rayleighchan(1e-4, 100, [0 1.1e-4], [0 0]);
h.StoreHistory = 1;
% Allow states to be stored
y = filter(h, ones(100,1)); % Process samples through channel
plot(h);
% Open channel visualization tool
AfterselectingavisualizationoptionandaspeedintheAnimationmenu,movetheSampleindexslider

controlallthewaytotheleftandclickResume.Theslidercontrolmovesbyitselfduringanimation.The
sampleindexincrementsautomaticallytoshowwhichsnapshotyouarevisualizing.
Youcanalsomovetheslidercontrolandglancethroughthesamplesoftheframeasyoulike.
AnimateSnapshotsAcrossFrames.
Thisexampleshowshowtoanimatesnapshotsacrossframes.Thefollowinglinesofcodecallthefilterand
plotmethodswithinalooptoaccomplishthis:

Ts = 1e-4;
fd = 100;

% Sample period (s)


% Maximum Doppler shift

% Initialize DPSK modulator for M=4


hMod = comm.DPSKModulator(4);
% Path delay and gains
tau = [0.1 1.2 2.3 6.2 11.3]*Ts;
PdB = linspace(0, -10, length(tau)) - length(tau)/20;
nTrials = 10000;
N = 100;

% Number of trials
% Number of samples per frame

h = rayleighchan(Ts, fd, tau, PdB); % Create channel object


h.NormalizePathGains = false;
h.ResetBeforeFiltering = false;
h.StoreHistory = 1;
h % Show channel object
% Channel fading simulation
for trial = 1:nTrials
x = randi([0 3],10000,1); % Random symbols
dpskSig = step(hMod, x);
% Modulated symbols
y = filter(h, dpskSig);
% Channel filter
plot(h);
% Plot channel response
% The line below returns control to the command line in
case
% the GUI is closed while this program is still running
if isempty(findobj('name', 'Multipath Channel')), break;
end;
end
Whiletheanimationisrunning,youcanmovetheslidercontrolandchangethesampleindex(whichalso
makestheanimationpause).AfterclickingResume,theplotcontinuestoanimate.
ThepropertyResetBeforeFilteringneedstobesettofalsesothatthestateinformationinthechannelis
notresetaftertheprocessingofeachframe.

RicianFadingChannel
QuasiStaticChannelModeling
Typically,apathgaininafadingchannelchangesinsignificantlyoveraperiodof1/(100fd)seconds,wherefd
isthemaximumDopplershift.Becausethisperiodcorrespondstoaverylargenumberofbitsinmany
modernwirelessdataapplications,assessingperformanceoverastatisticallysignificantrangeoffading
entailssimulatingaprohibitivelylargeamountofdata.Quasistaticchannelmodelingprovidesamore
tractableapproach,whichyoucanimplementusingthesesteps:
1. GeneratearandomchannelrealizationusingamaximumDopplershiftof0.
2. Processsomelargenumberofbits.
3. Computeerrorstatistics.
4. Repeatthesestepsmanytimestoproduceadistributionoftheperformancemetric.
Theexamplebelowillustratesthequasistaticchannelmodelingapproach.

M = 4;
% DQPSK modulation order
hMod = comm.DQPSKModulator;
% Create a DPSK modulator
hDemod = comm.DQPSKDemodulator;
% Create a DPSK demodulator
numBits = 10000;
numTrials = 20;

% Each trial uses 10000 bits.


% Number of BER computations

% Note: In reality, numTrials would be a large number


% to get an accurate estimate of outage probabilities
% or packet error rate.
% Use 20 here just to make the example run more quickly.
% Create Rician channel object.
chan = ricianchan;
% Static Rician channel
chan.KFactor = 3;
% Rician K-factor
% Because chan.ResetBeforeFiltering is 1 by default,
% FILTER resets the channel in each trial below.
% Create an AWGNChannel and ErrorRate calculator System object
hChan = comm.AWGNChannel('NoiseMethod', 'Signal to noise ratio
(SNR)');
hChan.SNR = 20;
hErrorCalc = comm.ErrorRate;
serVec = zeros(3,numTrials);
% Compute error rate once for each independent trial.
for n = 1:numTrials
reset(hErrorCalc)

tx = randi([0 M-1],numBits,1);
% Generate random bit
stream
dpskSig = step(hMod, tx);
% DPSK modulate signal
fadedSig = filter(chan, dpskSig);
% Apply channel effects
rxSig = step(hChan,fadedSig);
% Add Gaussian
noise.
rx = step(hDemod,rxSig);
% Demodulate.
% Compute number of symbol errors.
% Ignore first sample because of DPSK initial condition.
serVec(:,n) = step(hErrorCalc,tx(2:end),rx(2:end));
end
nErrors = serVec(2,:)
per = mean(nErrors > 0) % Proportion of packets that had errors
Whiletheexampleruns,theCommandWindowdisplaysthegrowinglistofsymbolerrorcountsinthevector
nErrors.Italsodisplaysthepacketerrorrateattheend.Thesampleoutputbelowshowsafinalvalueof
nErrorsandomitsintermediatevalues.Yourresultsmightvarybecauseofrandomnessintheexample.

nErrors =
Columns 1 through 9
0

Columns 10 through 18
0

Columns 19 through 20
0

216

per =
0.1000
MoreAbouttheQuasiStaticTechnique.Asanexampletoshowhowthequasistaticchannelmodeling
approachcansavecomputation,considerawirelesslocalareanetwork(LAN)inwhichthecarrierfrequency
is2.4GHz,mobilespeedis1m/s,andbitrateis10Mb/s.Thefollowingexpressionshowsthatthechannel
changesinsignificantlyover12,500bits:

1
100 f d

(
) (
s 10 Mb/s =

)
(
)
c
s 10 Mb/s
100vf

(
)
3 108 m/s
10 Mb/s
100(1 m/s)(2.4 GHz)
= 12, 500 b
=

AtraditionalMonteCarloapproachforcomputingtheerrorrateofthissystemwouldentailsimulating
thousandsoftimesthenumberofbitsshownabove,perhapstensofmillionsofbits.Bycontrast,aquasi
staticchannelmodelingapproachwouldsimulateafewpacketsateachofabout100locationstoarriveata
spatialdistributionoferrorrates.Fromthisdistributiononecoulddetermine,forexample,howreliablethe
communicationlinkisforarandomlocationwithintheindoorspace.Ifeachsimulationcontains5,000bits,
100simulationswouldprocesshalfamillionbitsintotal.Thisissubstantiallyfewerbitscomparedtothe
traditionalMonteCarloapproach.

AdditionalExamplesUsingFadingChannels
Thefollowingmodelsincludetheuseoffadingchannels:
RayleighFadingChannel,whichillustratesthechannel'seffectonaQPSKmodulatedsignal
IEEE802.11aWLANPhysicalLayer
DefenseCommunications:USMILSTD188110B
WCDMAEndtoEndPhysicalLayer

You might also like