How do I need to configure Matlab's solver such that it returns the correct solutions when complex magnitudes are involved?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dominik Hiltbrunner
le 16 Oct 2023
Commenté : Torsten
le 18 Oct 2023
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 commentaires
Réponse acceptée
Torsten
le 16 Oct 2023
Modifié(e) : Torsten
le 16 Oct 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 commentaires
Paul
le 18 Oct 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)
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
le 18 Oct 2023
First, I think the desired solution obtains only when (g1_g2)*Z > 1 (strictly greater).
w = 0 is also real.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Assumptions dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!