bipolar baseband modulation design
조회 수: 5 (최근 30일)
이전 댓글 표시
Design a bipolar baseband modulation for three pulse shapes:
(i) full-width rectangular NRZ pulse;
(ii) half-width rectangular RZ pulse;
(iii) raised cosine pulse with roll-off factor of 0.4.
(a) Sketch three baseband signal waveforms for 40 bits.
below is the first part of the code, but i keep getting " Array indices must be positive integers or logical values."
%%
N = 1000; % Number of periods
Nb = 20; % Number of samples per period
Nperiods = 20; % Number of periods to display
bipolar = randi([-1 1],N,1);
polari = randi([0 1],N,1);
bipolari = bipolar(polari);
n=0:19;
stem(n,polari(1:20),'fill','r'); ylim([-1.1 1.4]);
hold on
stem(n+0.3,bipolari(1:20),'fill','b');grid
xlabel('n'); ylabel('x(n)'); title('Binary and Bipolar Input')
legend('Binary','Bipolar')
set(gca,'FontSize',14,'XLim',[0 Nb+1],'XTick',[0:1:Nb+1]);
hold off
댓글 수: 0
답변 (1개)
Katie
2022년 4월 2일
polari is an array of 1's and 0's. If for example polari was [1, 1, 0, 1] then bipolari=bipolar(polari) would say that you want bipolari to equal [bipolar(1), bipolar(1), bipolar(0), bipolar(1)] and since Matlab indexing starts at 1, the bipolar(0) entry is causing the "Array indices must be positive integers or logical values." error.
If your goal is for bipolari to only equal bipolar at the indexes where polari is 1, then you could do the following:
bipolari=bipolar(logical(polari));
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Modulation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!