Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

why do i receive the error "Subscript indices must either be real positive integers or logicals" ?

1 view (last 30 days)
Hi
im trying to write down a code that calculate MMSE equalization coefficients , in this code K is the number of coefficients which gives 15 coefficients. all the time i run my m-file it replies "Subscript indices must either be real positive integers or logicals" and i dont no what to do about it . it appears that it need to add some part to it of course C matrix would be calculated later one , as i checked j loop stuck in -1 but still dont get it , could anyone suggest any idea ??? , here is my code :
clc
clear all
close all
a=[0.227 0.46 0.688 0.46 0.227];
aa=fft(a,100);
f=abs(aa);
f1=f/max(f);
f2=20*log10(f1);
k=7;
n0=0;
l=length(a);
x=conv(f,conj(f));
for i=-k:k
for j=-k:k
Gamma(i+k+1,j+k+1) = x(i-j+l+1);
end
end
  2 Comments
Walter Roberson
Walter Roberson on 25 Jun 2017
Why? Because your l = 5, and when i = -7 and j = -1, i-j+l+1 is -7-(-1)+5+1 = 0
Note: you should also be checking whether you should be using
x = conv(f, conj(f), 'same');
which you would use if you expect x to be the same size as f
HamidReza Saleh
HamidReza Saleh on 25 Jun 2017
x = conv(f, conj(f), 'same');
it didnt change anything , it appears that i need to define an "if" BUT where and how dont know i guess i consider -14 as 1

Answers (0)

This question is closed.

Community Treasure Hunt

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

Start Hunting!