debugging limit Error using sym/subsindex
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Jodie Lin
am 30 Okt. 2020
Bearbeitet: Steven Lord
am 30 Okt. 2020
syms k
f = 2*l1^k*v1 + 1*l2^k*v2 + 3*l3^k*v3
limit(f,k,inf)
This is giving me an error :
Error using sym/subsindex (line 857)
Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.
Error in sym/subsref (line 902)
R_tilde = builtin('subsref',L_tilde,Idx);
Error in Exploration10 (line 40)
limit(f(x),x,inf)
I tried
syms x h
f = 2*x;
limit(f,x,inf)
But it gives me the same error. What am I doing wrong
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 30 Okt. 2020
Bearbeitet: Steven Lord
am 30 Okt. 2020
The code you posted is not the code you ran. What you said you ran was:
syms k
f = 2*l1^k*v1 + 1*l2^k*v2 + 3*l3^k*v3
limit(f,k,inf)
What the error message says you ran was:
limit(f(x),x,inf)
Don't try to index into a variable (other than a symbolic function, which is less indexing and more evaluation) with a symbolic variable.
syms q
x = 1:10;
x(q) % will fail with the same error
syms g(x) x t
g(x) = sin(x); % symbolic function
g(t) % sin(t)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Conversion Between Symbolic and Numeric finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!