Simplifying solution to algebraic system of equations
조회 수: 1 (최근 30일)
이전 댓글 표시
The following code outputs a value for a and b with respect to the imaginary number i but the output is not fully simplified with the complex and real part separately factored. Is there a way to modify the code so the real and imaginary parts are separate?
syms X Y Q t w v a b z c N theta m L g
eq1 = b-a == 10*(cosd(45)+i*sind(45));
eq2 = 3 == (a-b)/4+a*i/3 + b/(6*i)+b/12;
sol = solve([eq1 eq2], [b a]); %[a b c] = [theta' theta'' x'']
sol_b = simplify(sol.b)
solb = sol.b
댓글 수: 0
채택된 답변
John D'Errico
2020년 4월 21일
It would be almost as easy to solve by hand.
>> sol = solve(eq1,eq2,[a,b]);
>> real(sol.a)
ans =
8*2^(1/2) + 36/5
>> imag(sol.a)
ans =
4*2^(1/2) - 72/5
b will be similar. The symbolic toolbox chooses to group the sqrt(2) stuff together, but I don't see the problem either way. If I had to guess, look at the expression:
sol.a
ans =
2^(1/2)*(8 + 4i) + 36/5 - 72i/5
Here, we have 8+4i as ONE number. A complex number, yet only one number. Likewise, (36/5 - 72i/5) may be thought of as only one number, not two numbers, just one complex number. So the form returned is actually simpler than what you want to see.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Equation Solving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!