Reset channel object
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.
Note: reset(chan,randstate) will not support randstate in a future release. See the legacychannelsim function for more information.
The example below shows how to obtain 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); c.ResetBeforeFiltering = 0; % Filter all ones. sig = ones(100,1); y1 = [filter(c,sig(1:50)); filter(c,sig(51:end))]; % Reset the channel and filter all ones. reset(c); % Generate an independent channel y2 = [filter(c,sig(1:50)); filter(c,sig(51:end))]; % Plot the magnitude of the channel output plot(abs([y1; y2]),'*') grid on
This example generates the following figure.