2016/10/18

Complex Number & Complex Conjugate 複數、共軛複數

complex number 複數
complex plane 複數平面
real part 實部
imaginary part 虛部

z = a + bi
Re(z) = a
Im(z) = b
i2 = -1
-i = 1/i proof: -i = -i × i/i = -i2/i =-(-1)/i = 1/i
∠z = tan-1(Im(z)/Re(z)) = tan-1(Ib/a)

z = rθ
r is modulus 模數 / magnitude 量值/大小
θ is argument 幅角/引數 / phase 相位/相角
r = |z|

argument 幅角
phase 相位/相角
in-phase 同相位
out-of-phase 不同相位
For Acos(ax + b), phase is b. and amplitude is A.

radian 徑度/弧度

phasor 相量

ejx = cosx + isinx = cisx     (Euler's formula)

complex conjugate 共軛複數
if z = a + bi,
the complex conjugate of z is
z_bar or z* = a - bi
Re(z*) = Re(z) = a
Im(z*) = -Im(z) = -b

To get z*, simply flip z around x-axis.

|z| = | a + bi | = √(a2 + b2)
|z|2 = |a + bi|2 = a2 + b2 = (a + bi )(a - bi ) = (z)(z*)

Matlab: conj()

>> z = 1 + 2i

z =
   1.0000 + 2.0000i

>> z_conj = conj(z)

z_conj =

   1.0000 - 2.0000i

conjugate transpose 共軛轉置

相關資料

Euler's formula

2016/10/07

Matlab: Vector, Matrix, Array and Row/Column Vector

In Matlab,

vector = one-dimensional array
matrix = two-dimensional array

The example below shows the difference between a row vector and a column vector:

>> x = 1:7

x =

     1     2     3     4     5     6     7

>> y = x'

y =

     1
     2
     3
     4
     5
     6
     7

where

x is a row vector.
y is a column vector.

Matlab: Submatrix/Subvector

A. The example below shows how to:

1. Define a vector with incrementing integers.
2. Define a second vector (subvector) which is formed from partial elements of the first vector.

>> a = 1:10

a =

     1     2     3     4     5     6     7     8     9    10

>> b = a(5:7)

b =

     5     6     7

B. The example below shows how to get a submatrix from an existing matrix:

c =

     1     2     3
     4     5     6
     7     8     9

>> d = c(2:3,2:3)

d =

     5     6
     8     9

C. Divide all elements of a vector by an integer:

>> e = a/2

e =

    0.5000    1.0000    1.5000    2.0000    2.5000    3.0000    3.5000    4.0000    4.5000    5.0000

C語言:檢查字元是否為英文字母 - isalpha()

To use function isalpha(), call

#include <ctype.h>

char ch;

...

if (isalpha(ch)) {
    //ch is an alphabet
} else {
    //ch is not an alphbet
}

Matlab: 儲存變數於MAT檔案中 Store Variables in MAT-files

PC

To store Matlab variables, select:

File -> Save Workspace As -> *.mat

To retrieve variables stored in a MAT-file, select:

File -> Open -> *.mat

Mac

Click the "Save Workspace" button or press the hotkey:

[command] + [s]


Matlab: 檢查是否已安裝工具箱 Check if Matlab Image Processing Toolbox already Installed

To check whether the Image Processing Toolbox has already been installed in Matlab, simply type:

help images

Companding 壓擴/壓伸

companding 壓擴/壓伸 = compressing 壓縮 + expanding 擴展

companded quantization = compressor + uniform quantizer 均勻量化 + expander

where

compressor 和 expander 的功能相反

目的:
當dynamic range有限時,透過先壓縮再還原,以減輕失真

在電話等語音通訊中,fricative擦音/磨擦音會因能量較低而無法被有效地量化
透過companding,可使這些語音細節得到較妥善地量化,進而有較好的效果

Companding algorithms of the G.711 ITU-T standard:
μ-law - USA/Japan - 動態範圍(dynamic range)較大,訊號弱時失真(distortion)較大
A-law - Europe - 訊號弱時音質較好

G.711支援A-law以及μ-law兩種編碼方式

Reference

Difference Between A-law and u-Law
G.711 (維基百科)