bipolar baseband modulation design

9 vues (au cours des 30 derniers jours)
NASA
NASA le 17 Fév 2022
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

Réponses (1)

Katie
Katie le 2 Avr 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));

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by