Sie sind auf Seite 1von 3

Create Data Array

1
N := 32 i := 0 , 1 .. N − 1 fs := 10000 Δt := T := N ⋅ Δt
fs
Sine Wave
Random Noise
fs
f := f := 7500
1.25
x := sin ( 2⋅ π⋅ f ⋅ i⋅ Δt) x := rnd ( 1)
i i

0.8

0.6
xi
0.4

0.2

0
−3 −3 −3 −3
0 1× 10 2× 10 3× 10 4× 10
Δt ⋅ i

Calculate Coefficients with FFT Algorithm. In MathCAD, fft and FFT are alternate forms. FFT
carries the negative sign on the exponential, and is multiplied by 1/N in going from time to
frequency. The function fft has the positive sign on the exponential, and is multiplied by
1/sqrt(N) in going from time to frequency.

N n
n := 0 , 1 .. X := N ⋅ FFT( x) rows ( X) = 17 f :=
2 n T

( n)
2 1 1
A := ⋅ X A := ⋅X A := ⋅X ϕ := arg X
n N n 0 N 0 N N N n
2 2

⎡⎡ N ⎤⎤
⎢⎢ 2 ⎥⎥
⎢⎢
x1( t) := A +
0 ⎢⎢ (An⋅ cos (2⋅ π⋅ f n⋅ t + ϕn))⎥⎥⎥⎥

⎣⎣n = 1 ⎦⎦
Signal Reconstruction
1

0.8
xi 0.6
x1( Δt⋅ i) 0.4

0.2

0
0 1 2 3 4
Δt⋅ i⋅ 1000

i1 := 0 , 1 .. 2 ⋅ ( N − 1 )

Signal Reconstruction over Two Periods


1

0.8
xi 0.6
x1( Δt⋅ i1) 0.4

0.2

0
−3 −3 −3 −3
0 2× 10 4× 10 6× 10 8× 10
Δt⋅ i , Δt⋅ i1
Display Amplitude, Phase Diagram

Amplitude Spectrum
0.5

0.4
Amplitude

0.3
An
0.2

0.1

0
3 3 3 3 3
0 1× 10 2× 10 3× 10 4× 10 5× 10
fn
Frequency (Hz)

Phase Spectrum
200
Phase (degrees)

100
180
ϕn⋅ 0
π
− 100

− 200
3 3 3 3 3
0 1× 10 2× 10 3× 10 4× 10 5× 10
fn
Frequency (Hz)

Parseval' Theorem for FFT.

N
N− 1 −1

∑ (xi − mean(x))
1 2 2
⋅ = 0.307261 ⎡ 1 ⋅ A 2⎤ + A 2 = 0.307261
N ∑⎢ ( n) ⎥ ⎛ N ⎞
i= 0 ⎣2 ⎦ ⎜ ⎟
n=1
⎝ 2⎠

Das könnte Ihnen auch gefallen