[error] - Error using sym/subsindex (line 855) Invalid indexing or function definition. Indexing must follow MATLAB indexing. Function arguments must be symbolic variables, and function body must be sym expression.

Hi,
In Matlab I'm trying to differentiate this multivariable eqaution respect to each variable to find minimums.
The code is summarily:
R=sym('R','real');
T_f=sym('T_f','real');
K=sym('K','real');
root_sum_square_diff =
((113387136614400/(14796771590290569*K + 805306368000000*R + 429496729600*pi*T_f + 113387136614400) - 917/10)^2 + (7046430720000/(14796771590290569*K + 12582912000000*R + 26843545600*pi*T_f + 7046430720000) - 481/5)^2 + (881810472960/(722498612807157*K + 2516582400000*R + 3355443200*pi*T_f + 881810472960) - 477/5)^2 + (1067030937600/(9912680967714189*K + 1572864000000*R + 5872025600*pi*T_f + 1067030937600) - 468/5)^2 + (859664547840/(3846582614585301*K + 1258291200000*R + 3690987520*pi*T_f + 859664547840) - 477/5)^2 + (2034892800/(34664410983609*K + 3072000000*R + 13926400*pi*T_f + 2034892800) - 458/5)^2)^(1/2)
when I launch the command:
diff(root_sum_square_diff,R)
I obtain this 2 errors:
Error using sym/subsindex (line 855)
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 900)
R_tilde = builtin('subsref',L_tilde,Idx);
Anybody can hel me? There's any other command I can use?

2 Comments

Actually I tried copying the instruction i wrote here and I have any problem too.
But when I launch the full code that provice me the function "sum_root_square_diff" the error came up.
Solved anyway

Sign in to comment.

Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products

Release

R2019b

Edited:

on 3 Dec 2019

Community Treasure Hunt

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

Start Hunting!