Power of faded signal after selection combiner
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Tasos
el 3 de Mzo. de 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 comentarios
Ver también
Categorías
Más información sobre Waveform Generation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!