Why do I get the error 'Subscript indices must either be real positive integers or logicals ' for the below code?

xa = (x-xc_t(t)+bx_t(t))/(sr2*betax_t(t));

4 comentarios

why? I'd guess most likely because you start with t==0
Don't use a time value as the indexing expression; use a time step number and an associated vector of actual times.
x, xc_t, bx_t, and betax_t are variables, while sr2 is the square root of 2.
True. Time starts at t=0 and then increases. The values of t are already being read from a text file, which was already saved as a 1x61 vector.
I'll check if indexing using the time step number would resolve it.
Thx

Iniciar sesión para comentar.

Respuestas (1)

t is either 0, negative, or some fractional value, like 3.00023 or something. If, before that line you put
format long
t
what does it show in the command window? How did you define t in the first place?

1 comentario

t starts at 0 in my case. Some values are indeed fractional. Time was read from another text file and imported as a 61x1 vector.

Iniciar sesión para comentar.

Categorías

Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 2 de En. de 2015

Editada:

el 2 de En. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by