How do I need to configure Matlab's solver such that it returns the correct solutions when complex magnitudes are involved?

1 次查看(过去 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:

采纳的回答

Torsten
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
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)
expression = 
sol = solve(expression*expression'==1,w,'ReturnConditions',true);
However, this doesn't change the solution posted above.
sol.w
ans = 
sol.conditions
ans = 
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)
ans = 
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)
ans = 

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Assumptions 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by