# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

## Loop-Shaping Controller Design

One of the most powerful yet simple controller synthesis tools is `loopsyn`. Given an LTI plant, you specify the shape of the open-loop systems frequency response plot that you want, then `loopsyn` computes a stabilizing controller that best approximates your specified loop shape.

For example, consider the 2-by-2 NASA HiMAT aircraft model (Safonov, Laub, and Hartmann [8]) depicted in the following figure. The control variables are elevon and canard actuators (δe and δc). The output variables are angle of attack (α) and attitude angle (θ). The model has six states:

`$x=\left[\begin{array}{c}{x}_{1}\\ {x}_{2}\\ {x}_{3}\\ {x}_{4}\\ {x}_{5}\\ {x}_{6}\end{array}\right]=\left[\begin{array}{c}\stackrel{˙}{\alpha }\\ \alpha \\ \stackrel{˙}{\theta }\\ \theta \\ {x}_{e}\\ {x}_{\delta }\end{array}\right]$`

where xe and xδ are elevator and canard actuator states.

Aircraft Configuration and Vertical Plane Geometry

You can enter the state-space matrices for this model with the following code:

```ag =[ -2.2567e-02 -3.6617e+01 -1.8897e+01 -3.2090e+01 3.2509e+00 -7.6257e-01; 9.2572e-05 -1.8997e+00 9.8312e-01 -7.2562e-04 -1.7080e-01 -4.9652e-03; 1.2338e-02 1.1720e+01 -2.6316e+00 8.7582e-04 -3.1604e+01 2.2396e+01; 0 0 1.0000e+00 0 0 0; 0 0 0 0 -3.0000e+01 0; 0 0 0 0 0 -3.0000e+01]; bg = [ 0 0; 0 0; 0 0; 0 0; 30 0; 0 30]; cg = [ 0 1 0 0 0 0; 0 0 0 1 0 0]; dg = [ 0 0; 0 0]; G = ss(ag,bg,cg,dg); % NASA HiMAT model G(s) ```

To design a controller to shape the frequency response (`sigma`) plot so that the system has approximately a bandwidth of 10 rad/s, you can set as your target desired loop shape Gd(s)=10/s, then use `loopsyn`(`G,Gd`) to find a loop-shaping controller for `G` that optimally matches the desired loop shape `Gd` by typing:

```s = zpk('s'); w0 = 10; Gd = w0/(s+.001); [K,CL,GAM] = loopsyn(G,Gd); % Design a loop-shaping controller K % Plot the results sigma(G*K,'r',Gd,'k-.',Gd/GAM,'k:',Gd*GAM,'k:',{.1,30}) legend('Achieved Loop Shape','Target Loop Shape','Gd/GAM','Gd*GAM') figure T = feedback(G*K,eye(2)); sigma(T,ss(GAM),'r*',{.1,30}); legend('Closed loop','GAM') grid ```

The value of γ= `GAM` returned is an indicator of the accuracy to which the optimal loop shape matches your desired loop shape and is an upper bound on the resonant peak magnitude of the closed-loop transfer function `T = feedback(G*K,eye(2))`. In this case, γ = 1.6024 = 4 dB, as the singular value plots show. The plots also show that the achieved loop shape matches the desired target `Gd` to within about γ dB.