How to solve a system of equations which contains mod() function?
5 次查看(过去 30 天)
显示 更早的评论
eqn represents a system of equations to be solved.
x = sym('x',[1 7],'integer');
assumeAlso(x>=0);
c = [1 2 1 -2 +2 0 -3;...
-2 1 -2 -2 3 -2 -2;...
0 -2 1 1 2 -2 -2;...
0 0 1 1 -2 3 -3;...
-3 0 -1 2 1 -2 3;...
2 3 2 -3 0 1 1;...
-2 -2 -1 -3 0 3 1].';
% a system of equations to be solved
eqn = mod([5; 1; 0; 2; 0; 5; 2]+sum(x.*c,2),10) == 4*ones([7 1])
% The solve() function can't solve this problem correctly
solve(eqn,x,"PrincipalValue",true)
% At least one solution exists
subs(eqn,x,[1 2 3 0 0 3 2])
It seems that solve() function can't solve a system of equations which contains mod() function, is there any other ways to solve eqn in MATLAB?
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!