Power of faded signal after selection combiner
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I have written a MATLAB code which plots the power of faded signal after passing through selection combiner. For this, I have created two independent Rayleigh faded signals and then used the concept of selection combiner. However, I am getting an error "Subscript indices must be real positive integers or logicals". I would deeply appreciate any help in this matter. Is there any syntax error or am I completely off the topic and my logic is flawed? Following is my code:
N=2000;
Ts = 1e-4; % Sample period (s)
fd = 100; % Maximum Doppler shift
%various channels
c1 = rayleighchan(Ts,fd); % Generate the channel fade
c2 = rayleighchan(Ts,fd);
sig = ones(2000,1); % Generate signal
y1 = filter(c1,sig);
y2 = filter(c2,sig);
%following code gives the dB values of faded signal
dbval1 = mag2db(abs(y1));
dbval2 = mag2db(abs(y2));
t = (0:N-1)'*Ts
plot(t,dbval1,'b');
ylabel('dB');
xlabel('Time');
hold on
plot(t,dbval2,'r');
for i = 0:N-1
if dbval1>dbval2
dbval3(i,:)= dbval1(i,:);
else
dbval3(i,:) = dbval2(i,:);
end
end
plot(t,dbval3, 'g');
0 Kommentare
Antworten (1)
Tasos
am 3 Mär. 2018
The problem is exactly what the error message says. The indices to your vectors/matrices must start from 1 in Matlab not 0, e.g. i=1:N.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matched Filter and Ambiguity Function 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!