필터 지우기
필터 지우기

how to get the argument and the modulus of a analytic complex function?

조회 수: 19 (최근 30일)
Rabih Sokhen
Rabih Sokhen 2021년 12월 7일
편집: John D'Errico 2021년 12월 7일
clear all
clc
syms a b c
z=a*exp(i*b*c)
arg=angle(z)
mod=abs(z)
as a result in the command window i am getting :
arg = angle(a*exp(b*c*1i))
mod= abs(a*exp(b*c*1i))
but what i want is :
arg= b*c
mod= a
any sugestion ?
thank you in advance

답변 (1개)

John D'Errico
John D'Errico 2021년 12월 7일
편집: John D'Errico 2021년 12월 7일
The use of mod as the name of a variable is a REALLY bad idea. Soon, when you begin using MATLAB more, you will trip over things like this, and then post a frantic question here, asking why does the mod function no longer work properly in MATLAB? (Or some similarly anxious question.) So don't use names like mod.
Your basic problem in that code, is the answer you want to get is not valid, at least if some of those parameters are not real numbers. But if we do this, restricting a,b,c to be all real valued,
syms a b c real
z = a*exp(i*b*c);
abs(z)
ans = 
Note that the modulus is NOT simply a, but abs(a). If a were negative, then would you expect the modulus to be negative? Of course not.
And as far as the phase angle goes, it is not quite as simple as you have shown it.
angle(z)
ans = 
Yes, I know you need not believe me. But that phase angle is a function of a also. For example, suppose a were 1 or -1?
Z1 = 1*exp(2i)
Z1 = -0.4161 + 0.9093i
Z2 = -1*exp(2i)
Z2 = 0.4161 - 0.9093i
[angle(Z1),angle(Z2)]
ans = 1×2
2.0000 -1.1416
So we would indeed expect two distinct phase angles for Z1 and Z2.
Your problem lies in your expectations.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by