MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

# Subscript indices must either be real positive integers or logicals

Asked by Nina on 28 Dec 2012

Hi all,

I'm trying to do the following:

% simulate a Poisson process with rate \lambda = 3/2
lambda = 3/2;
% MATLAB function poissrnd uses the waiting time method
random_sample = poissrnd(lambda, 1, 4000)

% estimate the distribution
p = poisscdf(random_sample, lambda)

% plot the distribution
x = min(random_sample):1:max(random_sample)
y = double(poisscdf(x, lambda))
z = x+1
plot(z,y)


but I keep getting this error message. Does anyone know what could the problem be?

Thanks a lot!

Jan Simon on 28 Dec 2012

Please post a copy of the error message, which reveals e.g. the line, which causes the error.

Nina on 29 Dec 2012

Actually, it worked well after I tried to run it again. Thanks for your time!

## Products

Answer by Jan Simon on 28 Dec 2012
Edited by Jan Simon on 28 Dec 2012
dbstop if error