%% Generate On-Off Application Traffic Pattern to Visualize Packet Sizes and Intervals
% Create a default On-Off application traffic pattern object.

cfgOnOff = networkTrafficOnOff;

% Generate an On-Off application traffic pattern with 200 On-Off packets.

for packetCount = 1:200
    [dt(packetCount),packetSize(packetCount)] = generate(cfgOnOff);
end

% Visualize the On-Off packet sizes.

stem(packetSize); 
title('Packet Size Versus Packet Number');
xlabel('Packet Number');
ylabel('Packet Size in Bytes');

% Visualize the On-Off packet intervals.

figure;
stem(dt); 
title('dt Versus Packet Number');
xlabel('Packet Number');
ylabel('dt in Milliseconds');

% Copyright 2020 The MathWorks, Inc.