Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Error "Subscript indices must either be real positive integers or logicals" in matlab

Status
Not open for further replies.

Chinmaye

Full Member level 3
Joined
Jan 18, 2016
Messages
164
Helped
0
Reputation
0
Reaction score
1
Trophy points
1,298
Activity points
3,145
Error "Subscript indices must either be real positive integers or logicals" in matlab

Hello all,
I am trying to run this simple program to calculate SNR. This is provided in the matlab documentation itself. But I get this error "Subscript indices must either be real positive integers or logicals."
Code:
rng default
Tpulse = 20e-3;
Fs = 10e3;
t = -1:1/Fs:1;
x = rectpuls(t,Tpulse);
y = 0.00001*randn(size(x));
s = x + y;
pulseSNR = snr(x,s-x)

Please help
 

Re: Error "Subscript indices must either be real positive integers or logicals" in ma

Only positive numbers can be used to index a vector.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top