Finding the magnitude and phase of a variable in a complex equation in terms of variables only
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Tiger Schad
le 26 Nov 2017
Commenté : Star Strider
le 26 Nov 2017
I would like to solve the following equation for the magnitude and phase of vo
vo = vi * ( r / ( r + (1/j*w*c)))
The problem is, I do not know how to specify that r, w and c have only real parts while vi is a complex number with a magnitude of vi and a phase of phi.
I have tried using real(r), real(w) etc. in the calculations however the calculation of the magnitude using abs() does not give me the desired answer.
>>syms vo vi r w c //FIRST METHOD//
>>vo=vi*(r/(r+(1/(j*w*c))))
vo =
(r*vi)/(r - 1i/(c*w))
>>abs(vo)
ans =
abs(r*vi)/abs(r - 1i/(c*w)) <--- magnitude contains imaginary number which i would like to be removed (included in the calculation)
>>syms vo vi r w c //SECOND METHOD//
>>vo = vi * real (r) / ( real(r) + 1/(j*real(c)*real(w)))
vo =
(vi*real(r))/(real(r) - 1i/(real(c)*real(w)))
>>abs(vo)
ans =
abs(vi*real(r))/abs(real(r) - 1i/(real(c)*real(w)))
Note that I would like to obtain the following expression: Assuming that vim is the magnitude of vi
abs(vo) = vim / ( 1+(1/r*w*c)^2)^(1/2)
angle(vo) = phi + atan2d(1/r*w*c)
0 commentaires
Réponse acceptée
Star Strider
le 26 Nov 2017
I cannot follow everything you are doing. For some reason, abs is not computing the magnitude of the complex function.
I was able to get this to work:
syms vo vi r w c % //FIRST METHOD//
vo=vi*(r/(r+(1/(1j*w*c))));
vo_mag = vo * conj(vo);
vo_mag = simplify(vo_mag)
vo_phs = atan(imag(vo)/real(vo))
vo_mag =
(c^2*r^2*vi^2*w^2)/(c^2*r^2*w^2 + 1)
vo_phs =
atan(1/(c*r*w))
Note that atan2 is not defined for symbolic expressions.
4 commentaires
Star Strider
le 26 Nov 2017
My pleasure.
I experimented with this problem a bit more. My results are the same as I posted them.
I did not need to specify ‘Vi’ to be real and positive to get the result I posted, and I specifically did not because you specified it as complex. It may inherit those assumptions from the assumptions on the other variables, although it should not. I cannot reproduce the problems you are seeing (my code as posted produces the results I posted), so I cannot suggest a solution.
Since I assume ‘c’ and ‘r’ are real and positive (the atan or atan2 argument takes the sign of ‘w’), the phase will be between 0° and 180°, so you can use atan. So for positive ‘w’, the phase will be between 0° and +90°.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Assumptions dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!