DSPRelated.com
Forums

NRZ

Started by saleh alawsh November 12, 2009
I have to generate NRZ I tried this cod but there are some errors. Any one can help me

% Initialize system parameters
Fs = 10000; % Sampling frequency (Hz)
Rs = 100; % Symbol rate (Sps)
nSamps = Fs/Rs; % Number of samples per symbol
Trise = 1/(5*Rs); % Rise time of the NRZ signal
Tfall = 1/(5*Rs); % Fall time of the NRZ signal
frameLen = 5000; % Number of symbols in a frame

% Set up the pattern generator
hSrcNRZ = commsrc.pattern('SamplingFrequency', Fs, ...
'SamplesPerSymbol', Rs, ...
'PulseType', 'NRZ', ...
'OutputLevels', [-1 1], ...
'RiseTime', Trise, ...
'FallTime', Tfall, ...
'DataPattern', 'PRBS10', ...
'Jitter', commsrc.combinedjitter);
% Generate NRZ signal
msgNRZ = generate(hSrcNRZ, frameLen);

% Plot the time domain signal
t = 0:1/Fs:15/Rs-1/Fs;
idx = round(t*Fs+1);
plot(t, msgNRZ(idx), 'r-');
grid on;
box on;