江树空 发表于 2013-9-7 15:13

关于matlab中phase函数和angle函数的区别

我用两种算法计算一个多输入多输出模型的传递函数得到结果(两组复数序列,分别对应两种算法的结果,分别记作H1_ij,Hv_ij,),分别对比两组复数序列实部和虚部,发现都能完全吻合。当用phase函数分别求这两组复数序列的相位时,发现当ij不同时,phase(H1_ij)和phase(Hv_ij)有时同相,有时相位差2pi,而angle(H1_ij)和angle(Hv_ij)则计算出的结果始终完全吻合。因此向各位大侠请教phase函数和angle函数的区别,望不吝赐教,谢谢回复!

ChaChing 发表于 2013-9-17 09:35

1.若有附加图形可能别人比较容易了解LZ说的问题
2.详看下help, 应该会有说明
3.若想进一步了解并确定, 或许可以直接看下该函数(使用edit)
4.google下, ref: http://stackoverflow.com/questions/12811401/difference-between-phase-and-angle-command-in-matlab

ChaChing 发表于 2013-9-18 23:02

想想应该直接贴上好像比较好
Matlab help for phase

PHASEComputes the phase of a complex vector

    PHI=phase(G)

    G is a complex-valued row vector and PHI is returned as its
    phase (in radians), with an effort made to keep it continuous
    over the pi-borders.Matlab help for angle

ANGLEPhase angle.
    ANGLE(H) returns the phase angles, in radians, of a matrix with
    complex elements.

    Class support for input X:
       float: double, single
At first, ANGLE command is from MATLAB core, PHASE from system identification toolbox.

ANGLE command always give result in range [-pi, pi].

PHASE command is more complex. If you have two adjacent points in input vector with phase near pi, for example

X=[-1+0.1i -1-0.1i]phase(X) command will give answer greater than pi for the second value (difference between phases values should be less than pi).

At this time angle(X) command will give value near -pi for the second argument (wrap values into range [-pi, pi]). E.g.

phase(X(2)) = angle(X(2)) + 2*pi
页: [1]
查看完整版本: 关于matlab中phase函数和angle函数的区别