I did a code for Rayleigh channel.I want to find the bit error rate after adding noise.Can you please help?
2 views (last 30 days)
Show older comments
sampleTime = 2.0e-006; maxDopplerShift = 200; % = v*f/c [Hz] maxDelay = 0.16; K=10; L=3; M=10; %delayVec = 1.0e-006 * [0 0.04 0.08]; % delays of three-path channel delayVec = 1.0e-004 * rand([K L-1]) * maxDelay; % create avg. path delays for each user (each has 3 paths) delayVec = [zeros(K,1) delayVec]; % First path is direct path, hence 0 delay for all users %gainVec = [0 -3 -6]; gainVec = -delayVec*10^6; % average path delays [dB], decay exponentially with delay (linearly in dB) %%
% Modulation hMod = modem.pskmod(2); bitsPerFrame = M; % Number of bits transmitted per frame = M , due to BPSK modulation
S = zeros(bitsPerFrame,K); % Create data matrix for K users, each having M symbols modulated_S = zeros(bitsPerFrame,K); % Modulated data matrix nFrames = 1; % Number of frames
% Create K impulse responses for each user for i=1:K h(i) = rayleighchan(sampleTime, maxDopplerShift, delayVec(i,:), gainVec(i,:)); h(i).StoreHistory = 1; h(i).ResetBeforeFiltering = 0; % preserve the continuity of fading process for n=1:nFrames S(:,i) = randi([0 1],bitsPerFrame,1); % Create the message bits for i-th user modulated_S(:,i) = modulate(hMod, S(:,i)); % Modulate the message of i-th user into BPSK symbols Y(:,i) = filter(h(i),modulated_S(:,i)); % Apply the channel of i-th user to the modulated message channel_vis(h(i), 'Visualization', 'fr'); % Frequency response figure; plot(h(i));
end
end % Y_dft=fft(Y,512); % k=0:511; % f=k*((2*pi)/512); % figure; % plot(f,abs(Y_dft));
0 Comments
Answers (0)
See Also
Categories
Find more on BPSK in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!