VPA error Index exceeds number of array elements

2 visualizaciones (últimos 30 días)
Dick Marruffo
Dick Marruffo el 15 de Sept. de 2021
Comentada: Dick Marruffo el 15 de Sept. de 2021
my VPA solve was working fine and then after running twice, I suddenly have an "Index exceeds number of array elements (1)"
This is what I am running, and its extremely simple. I dont know why it would stop working after functioning prior.
syms t
P(t)= 30/(3+7*exp((-.03*t)))
P(1960)
vpa(P(1960))

Respuestas (1)

the cyclist
the cyclist el 15 de Sept. de 2021
I'm confused, because the code you posted runs fine:
syms t
P(t)= 30/(3+7*exp((-.03*t)))
P(t) = 
P(1960)
ans = 
vpa(P(1960))
ans = 
9.9999999999999999999999993216384
Is it possible that somewhere in between you defined P as a variable, and then tried to access?
P = 7;
vpa(P(1960))
Index exceeds the number of array elements (1).
  1 comentario
Dick Marruffo
Dick Marruffo el 15 de Sept. de 2021
That's my issue. I didnt Change anything in my code, I just pressed the run button to ensure my formula was running and I got an error with no change. and I have double checked that P is not a variable

Iniciar sesión para comentar.

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by