Solving an equation with two variables, why is one being set to zero?
    조회 수: 5 (최근 30일)
  
       이전 댓글 표시
    
My code is as follows:
syms x y
[xRoot, yRoot] = solve((y-1).^2 + (x-1).^2 == floor(sqrt(2)-1).^2,y,x)
The output of this should (hopefully) be xRoot = 1, yRoot = 1 however in the actual output yRoot is being set to zero and xRoot is 1+-i.
How can I stop yRoot being set to zero and therefore not get complex roots for x?
Thanks.
댓글 수: 0
채택된 답변
  John D'Errico
      
      
 2017년 9월 28일
        There are multiple solutions here. This will help in your case though.
syms x y real
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
				Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

