How to solve a system of equations which contains mod() function?
조회 수: 2 (최근 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!