linear recursive relations: data generation reconstruction of lrr predictable by lrr

26
數數數數, Applied Mathematics ND HU 1 Linear Recursive Relations: •Data generation •Reconstruction of LRR •Predictable by LRR •Unpredictable by

Upload: truman

Post on 18-Jan-2016

31 views

Category:

Documents


0 download

DESCRIPTION

Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR Unpredictable by LRR. m > n. The number of unknowns is less than the number of linear equations. m > n: over-determined linear system. Solving linear systems with m>n. Input paired data - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 1

Linear Recursive Relations:•Data generation•Reconstruction of LRR•Predictable by LRR•Unpredictable by LRR

Page 2: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 2

mnmmm

n

n

n

nm

aaaa

aaaa

aaaa

aaaa

A

321

3333231

2232221

1131211

nx

x

x

x

3

2

1

x

mb

b

b

b

3

2

1

b

bAx

m1,...,ifor bi xaTi

Page 3: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 3

m > n

The number of unknowns is less than the number of linear equations.

m > n: over-determined linear system

Page 4: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 4

Page 5: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 5

Solving linear systems with m>n

Input paired data Form matrix A and

vector b Set x1 to pinv(A)*b Set x2 to

Page 6: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 6

N=30;A=rand(N,3);b=A*[1 0.5 -1]'+rand(N,1)*0.1-0.05;x1=pinv(A)*b;x2=inv(A'*A)*(A'*b);

Page 7: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 7

Applications

Linear convolution (auto regression)Linear recursive relations

Page 8: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 8

Fibonacci

Linear combination of predecessors

Page 9: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 9

Recurrent Relation

nf

F

2nf

1nf

Given and

the recurrent relation can generate an infinite sequence

0f 1f

n}{ nf

Page 10: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 10

Linear recursive relation

nf

F

2nf

1nf

F is linear

Page 11: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 11

Forward problem : data generation

function F=Fibonacci(N)F(0+1)=0;F(1+1)=1;for i=2:N F(i+1)=F(i-1+1)+F(i-2+1);endplot(1:length(F),F,'o')

Fibonacci.m

Page 12: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 12

Inverse problem

F[n]=a1F[n-1]+ a2F[n-2]+e, n=2..N

e denotes noiseGiven F[n], n=0,…,N, find a1 and a2

Page 13: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 13

Linear recursion

F[n]=a1F[n-1]+ a2F[n-2]+ e ,n=2..N

Given F[n], n=0,…,N, find a1 and a2

Linear system:

aa11 F[1]+ aa22 F[0]= F[2]aa11 F[2]+ aa22 F[1]= F[3]aa11 F[3]+ aa22 F[2]= F[4]aa11 F[4]+ aa22 F[3]= F[5]aa11 F[5]+ aa22 F[4]= F[6]...aa11 F[9]+ aa22 F[8]=F[10]

Page 14: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 14

Linear system

function [A,b]=formAb_Fib(F)N=length(F);b=F(2+1:N+1)';A=[F(1+1:N-1+1)' F(0+1:N-2+1)'];

formAb_Fib.m

Page 15: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 15

Linear recursion

f=Fibonacci(30);[A,b]=formAb_Fib(f)x =pinv(A)*b

Page 16: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 16

Linear recursive relation

Linear combination of predecessorsf[t]=a1f[t-1]+ a2f[t-2]+…+ af[t-]+ e[t],

t= ,…,N

Page 17: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 17

Linear recursive relation: delays

nf

F2nf

1nf

F is linear

nf

...

Page 18: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 18

nf

2nf

1nf

nf

.

.

.

nnnn fafafaf ...2211

Data generation by linear recursive relation

Fgen.m

L=10; N=80;a=pdf('norm', linspace(pi,-pi,L),0,1)-0.2;F=Fgen(a,N);

Page 19: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 19

Construction of Linear recursive relation

demo_FG.m

Form A and b x =pinv(A)*b

Blue: a1 … a

Red: Estimation

Page 20: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 20

Construction of Linear recursive relation

Form A and b x =pinv(A)*b

Blue: a1 … a

Red: Estimation

nf

2nf

1nf

nf

.

.

.

nnnn fafafaf ...2211

Page 21: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 21

Reconstruction of linear recursive relation

L=10; N=80;a=pdf('norm', linspace(pi,-pi,L),0,1)-0.2;F=Fgen(a,N);

[A b]=formAb(F,L);a_hat=pinv(A)*b;

Prediction of time series after N

time series before N

1:N

Page 22: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 22

Prediction of time series after N

Fprediction.m

ini_F=F(N-L+1:N);New_F=Fprediction(a_hat,ini_F,N);plot((1:length(New_F))+N,New_F);

Time series after N

N:2N

Page 23: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 23

Nonlinear recursive relation

z[t]=tanh(a1z[t-1]+ a2z[t-2]+…+ az[t-])+ e[t],

t= ,…,N

Page 24: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 24

Nonlinear recursiondemo_FG2.m

Form A and b x =pinv(A)*b

Blue: a1

… a

Red: x1 … x

Estimation

Page 25: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 25

Unpredictable by linear recursive relation

Data generation by nonlinear recursive relation

Linear recursive relation can not predict time series that are created by nonlinear recursive relation

Page 26: Linear Recursive Relations: Data generation Reconstruction of LRR Predictable by LRR

數值方法, Applied Mathematics NDHU 26

Prediction

Use initial -1 instances to generate the full time series (red) based on estimated linear parameters (red)