6.8. MATLAB Files
6.8.1. CRC Process
gx=[1 0 0 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1 0 1 1 0 1 1 1]; x=ceil(2*rand(1,8000)-1); xs=~x(1:33); for i=1:length(x)-33 if xs(1)~=0 xs=xor(xs,gx); end xs(1:32)=xs(2:33); xs(33)=x(i+33); end fcs=~xs
6.8.2. Aloha and Slotted Aloha Simulation
%SIMULATION PARAMETERS %simulation for pure Aloha protocol %total simulation time in seconds runtime=0.2; %total number of stations nstation=10; %transmission throughput of the media in bits per second netthrou=10e6; %frame size in bits fsize=8000; %avarage frame arrival rate per second for each station %frate=10; for frate=1:5:150 %average frame arrival rate per simulation iteration trh=frate/10000; %random wait window in number of simulation iterations wwind=100; ...
Get Home Network Basis: Transmission Environments and Wired/Wireless Protocols now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.