reset (channel)

Reset channel object

Syntax

reset(chan)
reset(chan,randstate)

Description

reset(chan) resets the channel object chan, initializing the PathGains and NumSamplesProcessed properties as well as internal filter states. This syntax is useful when you want the effect of creating a new channel.

reset(chan,randstate) resets the channel object chan and initializes the state of the random number generator that the channel uses. randstate is a two-element column vector. This syntax is useful when you want to repeat previous numerical results that started from a particular state.

Example

The example below shows how to get repeatable results. The example chooses a state for the random number generator immediately after defining the channel object and later resets the random number generator to that state.

% Set up channel.
% Assume you want to maintain continuity
% from one filtering operation to the next, except
% when you explicitly reset the channel.
c = rayleighchan(1e-4,100);
reset(c,[11; 13]); % Choose arbitrary state.
c.ResetBeforeFiltering = 0;

% Filter some data.
sig = randint(100,1);
y1 = [filter(c,sig(1:50)) filter(c,sig(51:end))];

% Try to repeat the results.
reset(c,[11; 13]); % Use same state as before.
y2 = [filter(c,sig(1:50)) filter(c,sig(51:end))];

isequal(y1,y2) % y1 and y2 should be the same.

The output is below.

ans =

     1

See Also

rayleighchan, ricianchan, filter, Fading Channels


© 1994-2005 The MathWorks, Inc.