How to make solve stop when a non-trivial solution is first found

조회 수: 7 (최근 30일)
I have a system of quadratic equations I would like to solve, something like below:
syms q11 q12 q13 q21 q22 q23 q31 q32 q33
[q11_sol, q12_sol, q13_sol, q21_sol, q22_sol, q23_sol, q31_sol, q32_sol, q33_sol] = ...
solve(...
q11*q22 == q12*q21*((T(1,1)*T(2,2))/(T(2,1)*T(1,2))), ...
q22*q33 == q23*q32*((T(2,2)*T(3,3))/(T(3,2)*T(2,3))), ...
q11*q33 == q13*q31*((T(1,1)*T(3,3))/(T(3,1)*T(1,3))), ...
q31^2 + q32^2 + q33^2 == 1, ...
q21^2 + q22^2 + q23^2 == 1, ...
q11^2 + q12^2 + q13^2 == 1, ...
q21*q31 + q22*q32 + q23*q33 == 0, ...
q11*q31 + q12*q32 + q13*q33 == 0, ...
q11*q21 + q12*q22 + q13*q23 == 0);
where T is some matrix I defined.
My issue is that solving this system takes a long time, and I just want one non-trivial solution (just one solution that doesn't have 0's or 1's or -1's in it).
Is there a way for me to tell the solve function to stop when a non-trivial solution is first found?
  댓글 수: 2
Tommi Muller
Tommi Muller 2020년 6월 1일
I mentioned that T is some predefined 3x3 matrix, but let's say for example that:
T = [-2/15, 8, 4; 2/5, -6, 6; -1/30, -1, 1/4];

댓글을 달려면 로그인하십시오.

채택된 답변

Abhisek Pradhan
Abhisek Pradhan 2020년 6월 5일
solve by default returns one of the many solutions. Now the problem lies in getting a solution which is not trivial. the following, link may help in working with full solution.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by