16장Fourier 해석 - Pusan National...

24
16장 Fourier 해석 16.1 사인함수를 이용한 곡선접합 16.2 연속 Fourier 급수 16.3 주파수 영역과 시간 영역 16.4 Fourier 적분과 변환 16.5 이산 Fourier 변환(DFT) 16.6 파워스펙트럼

Transcript of 16장Fourier 해석 - Pusan National...

Page 1: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

16장 Fourier 해석

16.1 사인함수를 이용한 곡선접합16.2 연속 Fourier 급수16.3 주파수 영역과 시간 영역16.4 Fourier 적분과 변환16.5 이산 Fourier 변환(DFT)16.6 파워스펙트럼

Page 2: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods

주기가 T인 주기함수

주기운동의 가장 기본: 원운동(코사인, 사인)

장 해석

16.1 사인함수를 이용한 곡선접합 (1/5)

( ) ( )f t f t T= +

0tω θ+

x

y

(1,0)

(0,1)

0cos( )tω θ+

0sin( )tω θ+

16 Fourier

Page 3: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods

일반적인 주기함수의 표현

-평균 높이 A0, 진폭 C1

-각주파수 ω0, 위상각 θ

주파수 f, 주기 관계 T:

곡선접합을 위한 Eq. (16.2) 형태 변환

장 해석

16.1 사인함수를 이용한 곡선접합 (2/5)

0 1 0( ) A cos( ) (16.2)f t C tω θ= + +

0 2 , 1/ Tf fω π= =

0 1 0 1 0( ) A A cos( ) B sin( ) (16.6)f t t tω ω= + +

1 1 1 1

1

1

A cos( ) & B sin( ) (16.7)

Barctan (16.8)A

C Cθ θ

θ

= = −

= −

여기서

16 Fourier

Page 4: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods

사인 선형 최고제곱 모델

오차의 제곱의 최소화 (MLS)

ω0에 대응하는 주기 T를 N등분한 시간간격에서 계산하면

장 해석

16.1 사인함수를 이용한 곡선접합 (3/5)

0 1 0 1 0( ) A A cos( ) B sin( ) (16.11)f t t t eω ω= + + +

[ ]{ }20 1 0 1 0

1cos( ) sin( )

n

r ii

S y A A t B tω ω=

= − + +∑0 0 0

20 0 0 0 1 0

20 0 0 0 1 0

cos( ) sin( )cos( ) cos ( ) cos( )sin( ) cos( ) (16.12)sin( ) cos( )sin( ) sin ( ) sin( )

N t t A yt t t t A y tt t t t B y t

ω ωω ω ω ω ωω ω ω ω ω

→ =

∑ ∑ ∑∑ ∑ ∑ ∑∑ ∑ ∑ ∑

0 0

1 0 1 0

1 0 1 0

0 0 1/ 0 00 / 2 0 cos( ) 0 2 / 0 cos( )0 0 / 2 sin( ) 0 0 2 / sin( )

N A y A N yN A y t A N y t

N B y t B N y tω ωω ω

= → =

∑ ∑∑ ∑∑ ∑

16 Fourier

Page 5: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods

16.1 사인함수를 이용한 곡선접합 (4/5)

장 해석

Q. 곡선 y=1.7+cos(4.189t+1.0472)에 대하여 t=0에서 1.35 사이의 범위에

대하여 △t=0.15 의 간격을 사용하여 10개의 이산값을 생성하고 이 정보 및

최소제곱 접합을 이용하여 식 (16.11)의 계수값들을 구하라.

t y ycos(ω0t) ysin(ω0t)0 2.200 2.200 0.000

0.15 1.595 1.291 0.938

0.30 1.031 0.319 0.980

0.45 0.722 -0.223 0.687

0.60 0.786 -0.636 0.462

0.75 1.200 -1.200 0.000

0.90 1.805 -1.460 -1.061

1.05 2.369 -0.732 -2.253

1.20 2.678 0.829 -2.547

1.35 2.614 2.114 -1.536

∑= 17.000 2.502 -4.330

16 Fourier

Page 6: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods

16.1 사인함수를 이용한 곡선접합 (5/5)

이 결과는 식(16.14-16)까지를 구하기 위하여 사용할 수 있다.

따라서 최소제곱접합은

식 (16.2)의 형식으로 바꾸면

장 해석

0 1 117.000 2 21.7, 2.502 0.5000, ( 4.330) 0.866

10 10 10A A B= = = = = − = −

0 0( ) 1.7 0.500cos( ) 0.866sin( )f t t tω ω= + −

0( ) 1.7 cos( 1.0472)f t tω= + +

앞서의해석은다음과같은일반적인모델로확장할수있다.

여기서등각격의데이터에대하여계수는다음과같다.

0 1 0 1 0 2 0 2 0

0 2 0

( ) cos( ) sin( ) cos(2 ) sin(2 )cos( ) sin( )m

f t A A t B t A t B tA m t B m t

ω ω ω ωω ω

= + + + + +

+ +

0 0 02 2, cos( ), sin( ), 1, 2,...,n n

yA A y n B y n n m

N N Nω ω= = = =∑ ∑ ∑

#이들 관계식은 회귀분석(N>2m+1) 뿐만 아니라 보간법이나 콜로케이션 방법(N=2m+1) 에도 적용

16 Fourier

Page 7: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.2 연속 Fourier 급수 (1/3)

주기 T의 함수에 대하여 연속 Fourier 급수는 다음과 같이 쓸 수 있다.

여기서 첫번째 모드의 각 주파수(ω0=2π/T)는기본주파수라하며,이주파수의정수배 2ω0, 3ω0 등을고조파(harmonics)라한다.식 (16.17)의 계수는 k=1. 2, …, 에 대하여 다음 식을 통하여 계산할

수 있다.

그리고 a0는 다음과 같다.

0 00 0

2 2( )cos( ) , ( )sin( )T T

k ka f t k t dt b f t k t dtT T

ω ω= =∫ ∫

0 0 01

( ) [ cos( ) sin( )] (16.17)k kk

f t a a k t b k tω ω∞

=

= + +∑

0 0

1 ( )T

a f t dtT

= ∫

16 Fourier

Page 8: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.2 연속 Fourier 급수 (2/3)

Q. 연속 Fourier 급수를 이용하여 높이가 2이고, 주기 T=2π/ω0 인 사각파를

근사하라.

사각파의평균높이는 0이므로 a0=0. 나머지계수들은:

이 적분을계산하면,

1 / 2 / 4( ) 1 / 4 / 4

1 / 4 / 2

T t Tf t T t T

T t T

− − < < −= − < < − < <

/2 /4 /4 /2

0 0 0 0/2 /2 /4 /4

2 2( )cos( ) cos( ) cos( ) cos( )T T T T

k T T T Ta f t k t dt k t dt k t dt k t dt

T Tω ω ω ω

− − −

= = − + − ∫ ∫ ∫ ∫

4 / ( ) 1,5,9,...4 / ( ) 3,7,11,...

0 even integersk

k for ka k for k

for k

ππ

== − = =

16 Fourier

Page 9: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.2 연속 Fourier 급수 (3/3)

같은방법으로 bk=0따라서 Fourier 급수근사는다음과같다.

Euler 공식에기초한복소수표현법

여기서

복소지수함수를이용한 Fourier 급수

그림 16.4사각파에 대한 Fourier 급수 근사

0 0 0 04 4 4 4( ) cos( ) cos(3 ) cos(5 ) cos(7 )

3 5 7f t t t t tω ω ω ω

π π π π= − + − +

cos( ) sin( )ixe x i x± = ±

1i = −

0

0/2

/2

( )

1 ( )

ik tk

k

T ik tk T

f t c e

c f t e dtT

ω

ω

=−∞

=

=

16 Fourier

Page 10: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.3 주파수 영역과 시간 영역 (1/3)

1( ) cos( )2

f t C t π= +

그림 16.6 시간영역/주파수영역(진폭,위상)

16 Fourier

Page 11: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.3 주파수 영역과 시간 영역 (2/3)

그림 16.7 사인곡선의 여러위상들과 관련위상 스펙트럼들

16 Fourier

Page 12: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.3 주파수 영역과 시간 영역 (3/3)

그림 16.8 사각파에 대한 (a)진폭 선스펙트럼 (b) 위상 선스펙트럼

16 Fourier

Page 13: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.4 Fourier 적분과 변환

주기함수 비주기함수

-T/2 T/2 -T/2 -∞ T/2 ∞

T∞

Fourier 급수 Fourier 적분

0

0/2

/2

( )

1 ( )

ik tk

k

T ik tk T

f t c e

c f t e dtT

ω

ω

=−∞

=

=

1( ) ( )2

( ) ( )

i t

i t

f t F e d

F f t e dt

ω

ω

ω ωπ

ω

−∞

∞ −

−∞

=

=

16 Fourier

Page 14: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.5 이산 Fourier 변환 (1/4)

공학에서 함수는 종종 한정된 개수의 이산값들의 집합으로 표현된다.

0

0

1

0

1

0

0 : 1 (16.26)

1 0 : 1 (16.27)

nik j

k jj

nik j

j kk

F f e for k n

f F e for j nn

ω

ω

−−

=

=

= = −

= = −

16 Fourier

Page 15: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.5 이산 Fourier 변환 (2/4)

DFT의 다른 특징:

Nyquist 주파수: 신호에서 측정할 수 있는 가장 높은 주파수, 샘

플링주파수의 절반

측정 가능한 가장 낮은 주파수: 총 샘플길의 역수

Ex) fs=1000 Hz (1초에 1000개의 샘플들)로 약 n=100개의 데이터

max

min

1 1 0.001s/sample1000 samples/s100 samplest 0.1

1000 samples/s1000 samples/s 10100 samples

0.5 0.5 1000 500

1 100.1

s

ns

s

or Nyquist s

tfn sfff Hzn

f f Hz Hz

f Hzs

∆ = = =

= = =

∆ = = =

= = × =

= =

16 Fourier

Page 16: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.5 이산 Fourier 변환 (3/4)

고속 Fourier 변환 (FFT, J.W. Cooley & J.W. Tukey, 1965)

그림 16.10 표준 DFT와 FFT에 대한 연산횟수 대 샘플 크기의 그림

16 Fourier

Page 17: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.5 이산 Fourier 변환 (4/4)

MATLAB 함수: fft

F = fft(f,n)

여기서

F=DFT를 포함하는 벡터이며

f= 신호를 포함하는 벡터

n = 데이터 개수

* f가 n점보다 작으면 0으로 채움

* F의 원소는 역순환 순서

(n=8이면 순서가 0, 1, 2, 3, 4, -3, -2, -1)

16 Fourier

Page 18: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

예제 16.3 (MATLAB을 이용한 단순 사인 함수의 DFT 계산 (1/4)

Q. MATLAB의 fft함수를 이용하여 단순 사인함수에 대한 이산

Fourier 변환을 계산하라.

∆t=0.02초인 8개의 등간격 점을 생성하고 결과를 주파수에 대하여 그려

라.풀이)

샘플링 주파수: fs = 1/∆t = 1/0.02s = 50 Hz

총 샘플길이: tn = n/fs = 8 samples/(50samples/s)=0.16 s

Nyquist 주파수: fmax = 0.5fs=0.5×50Hz=25Hz

최소 측정가능 주파수: fmin=1/0.16s=6.25 Hz

( ) 5 cos(2 12.5 ) sin(2 18.75 )f t t tπ π= + × × + × ×

16 Fourier

Page 19: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

예제 16.3 (MATLAB을 이용한 단순 사인 함수의 DFT 계산 (2/4)

>> n=8; dt=0.02; fs=1/dt; T=0.16;

>> tspan=(0:n-1)/fs;

>> y=5+cos(2*pi*12.5*tspan)+sin(2*pi*31.25*tspan);

>> subplot(3,1,1);

>> plot(tspan,y,'-ok','linewidth',2,'MarkerFaceColor','black');

>> grid on

>> title('(a) f(t) versus time (s)');

16 Fourier

Page 20: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods

예제 16.3 (MATLAB을 이용한 단순 사인 함수의 DFT 계산 (3/4)

장 해석

>> Y=fft(y)/n;

>> Y‘

ans =

5.0000

0.0000 - 0.0000i

0.5000 - 0.0000i

-0.0000 - 0.5000i

0

-0.0000 + 0.5000i

0.5000 + 0.0000i

0.0000 + 0.0000i

16 Fourier

Page 21: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

예제 16.3 (MATLAB을 이용한 단순 사인 함수의 DFT 계산 (4/4)

>> nyquist=fs/2;fmin=1/T;

>> f=linspace(fmin, nyquist, n/2);

>> Y(1)=[];YP=Y(1:n/2);

>> subplot(3,1,2)

>> stem(f,real(YP),'linewidt',2,'MarkerFaceColor','blue');

>> grid on;title('(b) Real component versus frequency')

>>subplot(3,1,3);stem(f,imag(YP),'linewidt',2,'MarkerFaceColor','bl

ue');

>> grid on;title('(c) Imaginary component versus frequency')

>> xlabel('frequency (Hz)')

16 Fourier

Page 22: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

16.6 파워스펙트럼

파워는 Fourier 계수들의 제곱을 합함으로써 계산할

수 있다: Parseval Theorem

( )022

0 02 *

2

0

2

( )

(note : for real function ( ) )1 ( )

T T ik tk

k k k

T

k

k k

f t dt c e dt

T c c c f t

f t dt PT

where P c

ω

=

= =

∴ =

=

∑∫ ∫∑

∑∫

16 Fourier

Page 23: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

예제 16.4 (MATLAB을 이용한 파워스펙트럼의 계산 계산 (1/2)

Q. 예제 16.3에서 DFT를 계산한 단순 사인함수에 대하여 파워 스펙

트럼을 계산하라.

풀이) %compute the DFT

clc;clf

n=8; dt=0.02; fs=1/dt; tspan=(0:n-1)/fs;

y=5+cos(2*pi*12.5*tspan)+sin(2*pi*18.75*tspan);

Y=fft(y)/n; f=(0:n-1)*fs/n;

Y(1)=[]; f(1)=[];

%compute and display the power spectrum

nyquist=fs/2; f=(1:n/2)/(n/2)*nyquist;

Pyy=abs(Y(1:n/2)).^2;

stem(f,Pyy,'linewidth',2,'MarkerFaceColor','blue')

title('Power Spectrum')

xlabel('Frequency (Hz)'); ylim([0 0.3]); grid on;

16 Fourier

Page 24: 16장Fourier 해석 - Pusan National Universitybml.pusan.ac.kr/Lecture/Undergraduates/NumAnalysis/16_FourierAnalysis.pdf · 16장Fourier 해석 16.1 . 사인함수를이용한곡선접합

Applied Numerical Methods 장 해석

예제 16.4 (MATLAB을 이용한 파워스펙트럼의 계산 계산 (2/2)

Q. 예제 16.3에서 DFT를 계산한 단순 사인함수에 대하여 파워 스펙

트럼을 계산하라.

풀이)

6 8 10 12 14 16 18 20 22 24 260

0.05

0.1

0.15

0.2

0.25

Power Spectrum

Frequency (Hz)

16 Fourier