Error using sym/subindex

4 visualizaciones (últimos 30 días)
Daniel Murphy
Daniel Murphy el 26 de Feb. de 2022
Respondida: Walter Roberson el 26 de Feb. de 2022
Good morning,
I've been transcribing code from a course to modify for my homework, however I run into the error, "Error using sym/subindex (line 953) when it goes to calculate a(j) when using Matlab Online. However, as shown below it runs when inputted into the forums version of Matlab.
Screenshot of Error:
My Code:
syms t p po T0 j
w0 = 2*pi/T0
p(t) = (po/T0)*t
a0 = 1/T0*int(p(t),t,0,T0)
a(j) = 2/T0*int(p(t)*cos(j*w0*t),t,0,T0)
syms t p po T0 j
w0 = 2*pi/T0;
p(t) = (po/T0)*t;
a0 = 1/T0*int(p(t),t,0,T0);
a(j) = 2/T0*int(p(t)*cos(j*w0*t),t,0,T0)
a(j) = 
  3 comentarios
Walter Roberson
Walter Roberson el 26 de Feb. de 2022
Works for me in MATLAB Online
Daniel Murphy
Daniel Murphy el 26 de Feb. de 2022
Restarted my computer and disconnected the previous session. That fixed it. I assume it's some sort of bug with connectivity to the server. Thanks.

Iniciar sesión para comentar.

Respuesta aceptada

Daniel Murphy
Daniel Murphy el 26 de Feb. de 2022
Appears to have been a bug with connection to the server. Was fixed by trestarting computer and disconnecting from the previous Matlab session.

Más respuestas (1)

Walter Roberson
Walter Roberson el 26 de Feb. de 2022
What you describe could happen in two ways:
  • if a already exists in the workspace somehow
  • if you were using r2019b or earlier, then if I recall correctly, the names pi, i, j, psi, and euler had special meaning as symbols and could not be used as variable names for defining the parameters of a symbolic function.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by