# 使用 FEEDBACK 来闭合反馈环

### 闭合反馈环的两种方式

```K = 2; G = tf([1 2],[1 .5 3])```
```G = s + 2 --------------- s^2 + 0.5 s + 3 Continuous-time transfer function. ```

• 使用 `feedback` 命令

• 使用公式

`$H=\frac{G}{1+GK}$`

`H = feedback(G,K)`
```H = s + 2 --------------- s^2 + 2.5 s + 7 Continuous-time transfer function. ```

`H2 = G/(1+G*K)`
```H2 = s^3 + 2.5 s^2 + 4 s + 6 ----------------------------------- s^4 + 3 s^3 + 11.25 s^2 + 11 s + 21 Continuous-time transfer function. ```

### 为什么使用 FEEDBACK 更好

`$G\left(s\right)=\frac{N\left(s\right)}{D\left(s\right)}$`

`G/(1+G*K)` 计算为：

`$\frac{N}{D}{\left(\frac{D+KN}{D}\right)}^{-1}=\frac{ND}{D\left(D+KN\right)}.$`

`zpk(H2)`
```ans = (s+2) (s^2 + 0.5s + 3) --------------------------------- (s^2 + 0.5s + 3) (s^2 + 2.5s + 7) Continuous-time zero/pole/gain model. ```

```load numdemo G H1 = feedback(G,1); % good H2 = G/(1+G); % bad```

```w = logspace(2,5.1,100); H0 = feedback(frd(G,w),1);```

```h = sigmaplot(H0,'b',H1,'g--',H2,'r'); legend('Reference H0','H1=feedback(G,1)','H2=G/(1+G)','location','southwest') setoptions(h,'YlimMode','manual','Ylim',{[-60 0]})```