bipolar baseband modulation design
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Katie
am 2 Apr. 2022
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 Kommentare
Siehe auch
Kategorien
Mehr zu Modulation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!