Clear Filters
Clear Filters

Can someone please help me?

1 view (last 30 days)
Alexandra Diaconu
Alexandra Diaconu on 29 Aug 2018
Commented: Yinglin Chen on 16 Jan 2020
I have this error: >> p5_7_Simulate_the_Error_Prob_of_OOK_NRZ_in_a_Multipath_Channel Undefined function or variable 'i_peak'.
Error in p5_7_Simulate_the_Error_Prob_of_OOK_NRZ_in_a_Multipath_Channel (line 25) pt = ones(1,nsamp).*i_peak;
What should I do? This is the code:
%%*****Channel Impulse response (using ceiling bounce model*************
Rb=200e6;
% Bit rate
Tb=1/Rb;
% bit duration
sig_length = 1e3;
% number of bits
nsamp = 10;
% samples per symbols
Tsamp = Tb/nsamp;
% sampling time
Dt=0.1;
% Normalized delay spread
Drms=Dt*Tb;
%RMS delay spread
a=12*sqrt(11/13)*Drms;
K=30*nsamp;
% number of channel taps
k=0:K;
h=((6*a^6)./(((k*Tsamp) + a).^7));
% channel impulse response
h=h./sum(h);
% normalizing for conservation of energy
%%system impulse response
pt = ones(1,nsamp).*i_peak;
% transmitter filter
rt=pt;
% receiver filter matched to pt
c=conv(pt,h);
c=conv(c,rt);
% overall impulse response of system
delay=find(c==max(c));
% channel delay
%%multipath simulation
if length(sig_length)==1
if sig_length>0
Range=[0, sig_length-1];
else Range=[sig_length+1, 0];
end
else Range =[min(sig_length), max(sig_length)];
end
OOK=randi(Range,1,sig_length);
% random signal generation
Tx_signal=rectpulse(OOK,nsamp).*i_peak;
% Pulse shaping function (rectangular pulse)
channel_output=conv(Tx_signal,h);
% channel output, without noise
Rx_signal=channel_output+sgma*randn(1,length(channel_output));
% received signal with noise
%Rx_signal=awgn(channel_output,EbN0+3-10*log10(nsamp), 'measured');
%%Matched filter simulation
MF_out=conv(Rx_signal,rt)*Tsamp;
% matched filter output
MF_out_downsamp=MF_out(delay:nsamp:end);
% sampling at end of bit period
MF_out_downsamp=MF_out_downsamp(1:sig_length);
% truncation
Rx_th=zeros(1,sig_length);
Rx_th(MF_out_downsamp > Ep/2) = 1;
  3 Comments
Alexandra Diaconu
Alexandra Diaconu on 29 Aug 2018
Thank you. I solved it.
Yinglin Chen
Yinglin Chen on 16 Jan 2020
So what is i_peak? I am trying to wirte a similar function.

Sign in to comment.

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 29 Aug 2018
Check here my previous answer

More Answers (0)

Categories

Find more on Detection, Range and Doppler Estimation 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!