# MATLAB error on solving a system of equations : Error using sym.getEqn​sVars>chec​kVariables (line 92)

12 views (last 30 days)
petit on 15 Apr 2021
I try to solve a system of equations with 3 unknowns called "`
FISH_O_SYM(1,1),FISH_O_SYM(2,2),FISH_O_SYM(1,2)
`" (the element
FISH_O_SYM(2,1)
is not necessary since **I force the symmetry** to have `
FISH_O_SYM(1,2) = FISH_O_SYM(2,1)
`)
For the moment, by doing at the final :
sol = solve(eqn, [FISH_O_SYM(1,1),FISH_O_SYM(2,2),FISH_O_SYM(1,2)])
I get interesting solutions in the context of my work.
But now, given the fact all of this is about a matricial equation between 2x2 matrix, I mean I have a system of 4 equations with 3 unknowns, I would like to introduce in the second matrix (see below) another unknown `SIGMA_O = sigma_o` : this is a factor applied on each element f the `FISH_O_SYM` matrix. I do it like this :
% Adding new observable "O" terms
FISH_O_SYM = sym('o_', [2,2], 'real');
SIGMA_O = sym('sigma_o', 'real');
FISH_O_SYM = 1/(SIGMA_O*SIGMA_O) * (tril(FISH_O_SYM.') + triu(FISH_O_SYM,1));
but once I call the `solve` function :
sol = solve(eqn, [FISH_O_SYM(1,1),FISH_O_SYM(2,2),FISH_O_SYM(1,2),SIGMA_O])
The solver complains and generate the error message :
FISH_O_SYM =
[ o_1_1/sigma_o^2, o_1_2/sigma_o^2]
[ o_1_2/sigma_o^2, o_2_2/sigma_o^2]
Error using sym.getEqnsVars>checkVariables (line 92)
Second argument must be a vector of symbolic variables.
Error in sym.getEqnsVars (line 56)
checkVariables(vars);
Error in sym/solve>getEqns (line 429)
[eqns, vars] = sym.getEqnsVars(argv{:});
Error in sym/solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});
Error in solve_obs_O_1BIN_GOOD_but_with_issue_on_sigma_o_dev (line 66)
sol = solve(eqn, [FISH_O_SYM(1,1),FISH_O_SYM(2,2),FISH_O_SYM(1,2),SIGMA_O])
I don't understand why he complains whereas in the first case, he succeed to solve the system of equations.
Any suggestion/track/clue/help is welcome to fix this issue.

R2020a

### Community Treasure Hunt

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

Start Hunting!