Unrecognized field name in solving symbolic matrix

3 views (last 30 days)
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

Accepted Answer

Walter Roberson
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)

Products


Release

R14SP2

Community Treasure Hunt

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

Start Hunting!