In-depth example or implementation of adaptive control (direct/indirect MRAC)? I have seen some examples where adaptive control is used to counter sudden changes in a system with great success. Since I find the subject quite interesting, I would like to learn how to actually implement an adaptive control loop, with the end goal being to write a flight controller for a quadcopter (this is something for the future though). I have found some quite good theoretical text-books on the matter, but not really any good in-depth examples or implementations. The methods that seems most interesting to me are the direct and indirect MRAC.

So in short: Where can I find a good in-depth example/implementation of an adaptive control loop?
I would begin with the excellent book by Gang Tao: http://www.amazon.com/Adaptive-Analysis-Learning-Processing-Communications/dp/0471274526/ref=sr_1_1?ie=UTF8&amp;qid=1365779105&amp;sr=8-1&amp;keywords=gang+tao+adaptive+control

You can very easily implement his algorithms in MATLAB/Simulink. For instance, the adaptive dead-zone and backlash algorithms are fairly straightforward.



Shiyu's answer, regrettably, contains a number of false assertions.

In any physical system, you are going to encounter parametric uncertainty. Consider a control actuator in a vehicle. You can spend millions of dollars attempting to identify what the free-play in the actuator will be. Then, you'll drive the vehicle, and the actuator will wear, and that free-play gap will change. Then, you'll bring it in for maintenance, and that gap changes again.

Then, the next vehicle rolls off the assembly line, and it will have a different operational/maintenance history, and have entirely different characteristics. Therefore, any parameter you identify experimentally will be obsolete, and using that value as a ground-truth for your parameterized system could actually be harmful.

MRAC is designed to identify and adapt to these parameters. Therefore, the controller will adapt to whatever the parameter happens to be. Furthermore, in many algorithms, convergence is guaranteed!

Model-building is a necessary step in any control scheme. MRAC allows you to use those same models for your adaptive controller. In fact, adaptive control schemes can sit on top of extant control laws without the need to modify the stable controller at all.

MRAC is not used in flight controls not because it is too slow or too risky; it's because Validation and Verification (V&amp;V) is so expensive and difficult. But for a remote-controlled quadrotor, an adaptive controller is a completely suitable approach. The algorithms are real-time algorithms, so there is no need for multiple iterations per time step. If you have a simple linearized model, all you'll need is to be able to clear a few matrix-vector multiplications in each time step. That's not terribly difficult. Obviously, it depends on the dimensionality of your model, but your quadrotor model shouldn't be that complex.
First, I would recommend you to search and read some academic papers on what you are interested in. I believe there are many papers on designing adaptive control for quadrotors with implementations.

Second, in my opinion, it is not quite proper to apply adaptive control to flight control. 
Reason 1: Adaptive control usually are applicable to systems with unknown but constant parameters. In flight control, usually it is required to build a very good flight model before you start to design controllers. A flight model with unknown parameters is not acceptable. If there is an unknown parameter, in stead of designing an adaptive controller to handle this parameter, we should do experiments to identify it. Reason 2: flight control requires controllers to response fast. But adaptive control usually are applied to relatively slow plants such as industrial processes. It is possible a quadrotor crashes before the adaptive control can stabilize it.

So if the model is not highly nonlinear, PID, LQR, $H_2$, $H_{\infty}$ probably are good choices. If the model is highly nonlinear, you need to employ some nonlinear control methods such as feedback linearization, backstepping, sliding mode control.