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

2 Ansichten (letzte 30 Tage)
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:

Akzeptierte Antwort

Torsten
Torsten am 16 Okt. 2023
Bearbeitet: Torsten am 16 Okt. 2023
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 Kommentare
Paul
Paul am 18 Okt. 2023
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 am 18 Okt. 2023
First, I think the desired solution obtains only when (g1_g2)*Z > 1 (strictly greater).
w = 0 is also real.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by