フィルターのクリア

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 = 
Torsten
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 ExchangeAssumptions についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by