Unrecognized field name in solving symbolic matrix
3 views (last 30 days)
Show older comments
Wenbin Dong
on 13 Jan 2022
Commented: Wenbin Dong
on 13 Jan 2022
I am new to symbolic toolbox. My problem is that the symbolic symbols defined in vectors became "Unrecognized field name".
For a simple example:
clear u1 u2 u3 f1 f2 f3
syms u1 u2 u3 f1 f2 f3
u =[u1;u2;u3];
f =[f1;f2;f3];
kg=[2, 1, 1;-1, 1, -1;1, 2, 3];
uu=kg*u;
eqns = [uu(1)==f(1), uu(2)==f(2), uu(3)==f(3)];
S=solve(eqns);
sol = [S.f1; S.f2; S.f3];
I really need to define symbolic variables by 'for' loop as the real problem is much larger.
Any comments are welcomed.
Thanks
0 Comments
Accepted Answer
Walter Roberson
on 13 Jan 2022
You did not specify which variables to solve for, and you have more variables than equations. solve() choose variables to solve for.
It is more robust to specify the variables you want to solve for.
More Answers (0)
See Also
Categories
Find more on Assumptions 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!