Can someone please help me?
조회 수: 3 (최근 30일)
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!