www.gusucode.com > control_featured 案例源码程序 matlab代码 > control_featured/PassivityIndicesExample.m

    %% Passivity Indices
% This example shows how to compute various measures of passivity for
% linear time-invariant systems.

% Copyright 2015 The MathWorks, Inc.


%% Passive Systems
% A linear system G(s) is passive when all I/O trajectories $(u(t),y(t))$
% satisfy
%               
% $$ \int_0^T {y^T(t) u(t)} dt > 0,\quad \forall T>0 $$
% 
% where $y^T(t)$ denotes the transpose of $y(t)$.
%
% <<../passive.png>>
%   
%%
% To measure "how passive" a system is, we use passivity indices.
%
% * The input passivity index is defined as the largest $\nu$ such that
%
% $$ \int_0^T y^T(t)u(t)dt > \nu  \int_0^T u^T(t) u(t)) dt $$
%
%%
% The system G is "input strictly passive" (ISP) when $\nu>0$. $\nu$ is
% also called the "input feedforward passivity" (IFP) index and corresponds
% to the minimum feedforward action needed to make the system passive.
%
% * The output passivity index is defined as the largest $\rho$ such that
%
% $$\int_0^T (y^T(t)u(t)dt >  \rho \int_0^T y^T(t)y(t)) dt  $$
%
%%
% The system G is "output strictly passive" (OSP) when $\rho>0$. $\rho$ is
% also called the "output feedback passivity" (OFP) index and corresponds
% to the minimum feedback action needed to make the system passive.
%
% * The I/O passivity index is defined as the largest $\tau$ such that
%
% $$ \int_0^T y^T(t)u(t) dt >  \tau \int_0^T \left(u^T(t) u(t) + y^T(t)y(t)\right) dt  $$
%
% The system is "very strictly passive" (VSP) if $\tau>0$.

%% Circuit Example
% Consider the following example. We take the current $I$ as the input and
% the voltage $V$ as the output. Based on Kirchhoff's current and voltage
% law, we obtain the transfer function for $G(s)$,
%
% $$ G(s)  = \frac{V(s)}{I(s)} = \frac{(Ls+R)(Rs+\frac{1}{C})}{Ls^2 + 2Rs
% +\frac{1}{C}} . $$
% 
% <<../circuit.png>>
%

%% 
% Let $R = 2$, $L =1$ and $C = 0.1$.

R = 2; L = 1; C = 0.1; 
s = tf('s');
G = (L*s+R)*(R*s+1/C)/(L*s^2 + 2*R*s+1/C);

%% 
% Use |isPassive| to check whether $G(s)$ is passive.

PF = isPassive(G)

%%
% Since PF = true, $G(s)$ is passive. Use |getPassiveIndex|
% to compute the passivity indices of $G(s)$.

% Input passivity index
nu = getPassiveIndex(G,'in')
% Output passivity index
rho = getPassiveIndex(G,'out')
% I/O passivity index
tau = getPassiveIndex(G,'io')

%%
% Since $\tau>0$, the system $G(s)$ is very strictly passive. 

%% Frequency-Domain Characterization
% A linear system is passive if and only if it is "positive real": 
%
% $$ G(j\omega)+G^H(j\omega) >0 \quad \forall \omega \in \bf{R} . $$
% 
% The smallest eigenvalue of the left-hand-side is related to the 
% input passivity index $\nu$:
%
% $$ \nu =  \frac{1}{2}\min_{\omega} \lambda_{\min}\left(G(j\omega)+G^H(j\omega)\right)  $$
% 
% where $\lambda_{\min}$ denotes the smallest eigenvalue. Similarly, when $G(s)$ is
% minimum-phase, the output passivity index is given by:
%
% $$ \rho =  \frac{1}{2}\min_{\omega} \lambda_{\min}\left(G^{-1}(j\omega) + G^{-H}(j\omega)\right) .  $$
% 
%%
% Verify this for the circuit example. Plot the Nyquist plot of the circuit
% transfer function.

nyquist(G)

%%
% The entire Nyquist plot lies in the right-half plane so $G(s)$ is
% positive real. The leftmost point on the Nyquist curve is $(x,y)=(2,0)$
% so the input passivity index is $\nu = 2$, the same value we obtained earlier. 
% Similarly, the leftmost point on the Nyquist curve for $G^{-1}(s)$ gives
% the output passivity index value $\rho = 0.286$.

%% Relative Passivity Index 
% It can be shown that the "positive real" condition
%
% $$ G(j\omega)+G^H(j\omega) >0 \quad \forall \omega \in \bf{R}  $$
% 
% is equivalent to the small gain condition
%
% $$ ||(I-G(j\omega))(I+G(j\omega))^{-1}|| < 1 \quad \forall \omega \in \bf{R} .$$
%
% The relative passivity index (R-index) is the peak gain over
% frequency of $(I-G)(I+G)^{-1}$ when $I+G$ is minimum phase,
% and $+\infty$ otherwise:
%
% $$R = \left\|(I-G)(I+G)^{-1} \right\|_\infty . $$ 
% 
% In the time domain, the R-index is the smallest $r>0$ such that 
%
% $$\int_0^T {||y-u||^2} dt < r^2 \int_0^{T} {||y+u||^2} dt$$
%
% The system $G(s)$ is passive if and only if $R<1$, and the smaller $R$ is, 
% the more passive the system is. Use |getPassiveIndex| to compute the
% R-index for the circuit example.

R = getPassiveIndex(G)

%%
% The resulting $R$ value indicates that the circuit is a very passive
% system.