How do I need to configure Matlab's solver such that it returns the correct solutions when complex magnitudes are involved?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi community
I am trying to solve the equation
where g1, g2, Z, and C are positive, real numbers. w is the independent variable. It is real but can be negative. j is the imaginary number. The following Matlab code returns a imaginary result, although there should be a real solution:
clc; clear;
syms g1 g2 Z C positive
syms w real
expression = (g1+g2)*Z/(1+1i*w*Z*C)
solve(abs(expression)==1,w)
What am I missing? Here is my hand calculation:
댓글 수: 0
채택된 답변
Torsten
2023년 10월 16일
편집: Torsten
2023년 10월 16일
Better use
solve(expression*expression'==1,w)
instead of
solve(abs(expression)==1,w)
From your hand calculation it follows that you must assume that
(g1+g2)*Z >= 1
to get a real solution w.
댓글 수: 7
Paul
2023년 10월 18일
I too am confused about a few things.
First, I think the desired solution obtains only when (g1_g2)*Z > 1 (strictly greater).
Second, I changed assume to assumeAlso, otherwise solve loses sight of the fact that g1, g2, and Z must be positive (and more importantly that they are real).
syms g1 g2 Z C positive
syms w real
assumeAlso((g1+g2)*Z > 1)
expression = (g1+g2)*Z/(1+1i*w*Z*C)
sol = solve(expression*expression'==1,w,'ReturnConditions',true);
However, this doesn't change the solution posted above.
sol.w
sol.conditions
As I understand it, solve is supposed to respect assumptions, so I don't understand why it's considering Z*(g1+g2) = 1 as a possibility.
Furthermore, the conditions are always true (presumably under the given assumptions)
simplify(sol.conditions,100)
so it's unclear why they are returned as conditions at all. The implication is that the conditions don't need to be assumed to simplify sol.w, and that is, in fact, the case
simplify(sol.w,100)
Torsten
2023년 10월 18일
First, I think the desired solution obtains only when (g1_g2)*Z > 1 (strictly greater).
w = 0 is also real.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!