MATLAB: Subscript indices must either be real positive integers or logicals

MATLAB

what should i do to not get this error? >> Subscript indices must either be real positive integers or logicals.

Best Answer

Remember,
Q(sqrt(EbN0))
means to take the square root of EbN0, and then try to use that square root as an index into the variable Q (which is a scalar.) There is no implied multiplication in MATLAB: if you want
Q .* sqrt(EbN0)
then you have to write that.