260 likes | 403 Views
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
E N D
Linear Recursive Relations: • Data generation • Reconstruction of LRR • Predictable by LRR • Unpredictable by LRR 數值方法, Applied Mathematics NDHU
m > n • The number of unknowns is less than the number of linear equations. • m > n: over-determined linear system 數值方法, Applied Mathematics NDHU
Solving linear systems with m>n Input paired data Form matrix A and vector b Set x1 to pinv(A)*b Set x2 to 數值方法, Applied Mathematics NDHU
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); 數值方法, Applied Mathematics NDHU
Applications • Linear convolution (auto regression) • Linear recursive relations 數值方法, Applied Mathematics NDHU
Fibonacci Linear combination of predecessors 數值方法, Applied Mathematics NDHU
Recurrent Relation F Given and the recurrent relation can generate an infinite sequence 數值方法, Applied Mathematics NDHU
Linear recursive relation F F is linear 數值方法, Applied Mathematics NDHU
Forward problem : data generation Fibonacci.m 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); end plot(1:length(F),F,'o') 數值方法, Applied Mathematics NDHU
Inverse problem • F[n]=a1F[n-1]+ a2F[n-2]+e, n=2..N • e denotes noise • Given F[n], n=0,…,N, find a1 and a2 數值方法, Applied Mathematics NDHU
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: a1F[1]+ a2 F[0]= F[2] a1 F[2]+ a2 F[1]= F[3] a1 F[3]+ a2 F[2]= F[4] a1 F[4]+ a2 F[3]= F[5] a1 F[5]+ a2 F[4]= F[6] . . . a1 F[9]+ a2 F[8]=F[10] 數值方法, Applied Mathematics NDHU
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 數值方法, Applied Mathematics NDHU
Linear recursion f=Fibonacci(30); [A,b]=formAb_Fib(f) x =pinv(A)*b 數值方法, Applied Mathematics NDHU
Linear recursive relation • Linear combination of predecessors • f[t]=a1f[t-1]+ a2f[t-2]+…+ af[t-]+ e[t], t= ,…,N 數值方法, Applied Mathematics NDHU
Linear recursive relation: delays F . . . F is linear 數值方法, Applied Mathematics NDHU
. . . 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); 數值方法, Applied Mathematics NDHU
Construction of Linear recursive relation demo_FG.m Form A and b x =pinv(A)*b Blue: a1 … a Red: Estimation 數值方法, Applied Mathematics NDHU
. . . Construction of Linear recursive relation Form A and b x =pinv(A)*b Blue: a1 … a Red: Estimation 數值方法, Applied Mathematics NDHU
Reconstruction of linear recursive relation 1:N L=10; N=80; a=pdf('norm', linspace(pi,-pi,L),0,1)-0.2; F=Fgen(a,N); time series beforeN [A b]=formAb(F,L); a_hat=pinv(A)*b; Prediction of time series after N 數值方法, Applied Mathematics NDHU
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); N:2N Time series after N 數值方法, Applied Mathematics NDHU
Nonlinear recursive relation • z[t]=tanh(a1z[t-1]+ a2z[t-2]+…+ az[t-])+ e[t], t= ,…,N 數值方法, Applied Mathematics NDHU
Nonlinear recursion demo_FG2.m Form A and b x =pinv(A)*b Blue: a1 … a Red: x1 … x Estimation 數值方法, Applied Mathematics NDHU
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 數值方法, Applied Mathematics NDHU
Prediction • Use initial -1 instances to generate the full time series (red) based on estimated linear parameters (red) 數值方法, Applied Mathematics NDHU