From c0c0582462720ed597b00e116506570577614e89 Mon Sep 17 00:00:00 2001 From: shamikam Date: Tue, 7 Nov 2017 15:59:48 +0530 Subject: initial commit --- macros/latcfilt1.sci | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 macros/latcfilt1.sci (limited to 'macros/latcfilt1.sci') diff --git a/macros/latcfilt1.sci b/macros/latcfilt1.sci new file mode 100644 index 0000000..194ec76 --- /dev/null +++ b/macros/latcfilt1.sci @@ -0,0 +1,28 @@ +//Author: Parthasarathi Panda +//parthasarathipanda314@gmail.com +//the function is for application on vectors only +function [f,g,zo]=latcfilt1(k,v,x,zi) + N=length(k); + gv=zi; + //gv[n+1]=Agv[n]+Bfv[n] + //fv[n]=-Cgv[n]+Dx[n] + //computing A,B,C and D as required by the system + C=[]; + for i=[1:N] + C=[C;[zeros(1,N-i),(k(i:N))']] + end + A=[zeros(1,N);[eye(N-1,N-1),zeros(N-1,1)]]; + B=[1,zeros(1,N-1);diag(k(1:(N-1))),zeros(N-1,1)]; + D=ones(N,1); + l=length(x); + g=[]; + f=[]; + //iterating through the input entry + for i=[1:l] + fv=D*x(i)-C*gv; + gv=A*gv+B*fv; + g=[g;gv(N)+k(N)*fv(N)]; + f=[f;v(N+1)*g(i)+(v(1:N))'*gv]; + end + zo=gv; +endfunction -- cgit