Invalid indexing when simplifying a symbolic expression
Show older comments
I am trying to somplfy an expression using the script below.
clc,clear
syms k4f k3f k3r k2f k2r C E0 S
eqn = k4f*(E0 - E0*(k3r+k4f) / (((k3f*k2f*C*S)/k2r)+(k3r*k4f)*(1+k2f*C/k2r)) - E0*k2f*C(k3r+k4f) / k2r*(((k3f*k2f*C*S)/k2r)+(k3r*k4f)*(1+k2f*C/k2r)));
simplfy(eqn)
When trying to simplfy "eqn", I get the following error messages...
Error using sym/subsindex (line 814)
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 859)
R_tilde =
builtin('subsref',L_tilde,Idx);
Error in Simplify_Eqn (line 3)
eqn = k4f*(E0 - E0*(k3r+k4f) /
(((k3f*k2f*C*S)/k2r)+(k3r*k4f)*(1+k2f*C/k2r)) -
E0*k2f*C(k3r+k4f) /
k2r*(((k3f*k2f*C*S)/k2r)+(k3r*k4f)*(1+k2f*C/k2r)));
>>
Any help is appreciated!
1 Comment
madhan ravi
on 13 Sep 2019
C you’re missing an operator here (k3r+k4f)
Answers (1)
Fabio Freschi
on 13 Sep 2019
C is used as a function
C(k3r+k4f)
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!