# Arquivo.zip

• atlfm
了解作者
• matlab
开发工具
• 1KB
文件大小
• zip
文件格式
• 0
收藏次数
• 1 积分
下载积分
• 3
下载次数
• 2018-11-11 02:02
上传日期
matlab filter good for matlab filter you
Arquivo.zip
• riccati.m
1.4KB
• princeton.m
687B

clc clear all n=2; m=1; t1=1; t0=.5; A=[-0.995591312646866,-1.249081404879689; 0.320053945411928,1.163391509093344]; B=[-0.216261377558112; 2.120734989643097]; Q=[2.60795573245784,1.26610295835102; 1.26610295835102,2.95448749241003]; R= 0.00137941893917394; %A=randn(n,n); %B=randn(n,m); %Q=randn(n,n); Q=Q?*Q; %R=randn(m,m); R=R?*R; S=B*(R\B'); H=[A, -S;-Q,-A']; % Compute the real Schur form of the Hamiltonian [U,T]=schur(H); % Make it a complex Schur form for easy eigenvalue swapping. for j=1:2*n-1 if (abs(T(j+1,j))>1e-16) [V,D]=eig(T(j:j+1,j:j+1)); [G,r]=qr(V); T(j:j+1,:)=G'*T(j:j+1,:); T(:,j:j+1)=T(:,j:j+1)*G; U(:,j:j+1)=U(:,j:j+1)*G; end end % Swap eigenvalues so that unstable eigenvalues are first % To get a negative definite solution to the CARE. % Comment out to get no sorting of eigenvalues. % Currently this is set to give a positive definite solution % to the Riccati equation. for j=1:2*n for k=1:2*n-1 if (real(T(k,k)) > real(T(k+1,k+1))) G=givens(T(k,k+1),T(k+1,k+1)-T(k,k)); T(k:k+1,:)=G*T(k:k+1,:); T(:,k:k+1)=T(:,k:k+1)*G'; U(:,k:k+1)=U(:,k:k+1)*G'; T(k+1,k)=0; end end end % Form the maximal CARE solution. G=U(1:2*n,1:n)/U(1:n,1:n); P=G(n+1:2*n,:); J=eye(2*n); J=J([[n+1:2*n],[1:n]],:); J(1:n,n+1:2*n)=-J(1:n,n+1:2*n);

相关推荐