Error using sym/subindex
2 次查看(过去 30 天)
显示 更早的评论
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/908265/image.png)
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)
3 个评论
采纳的回答
更多回答(1 个)
Walter Roberson
2022-2-26
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Assumptions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!