Power of faded signal after selection combiner
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Tasos
2018 年 3 月 3 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Waveform Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!