What adaptive controller can be used in embedded system with low RAM? This is not a question for data science, hardware or programming languages. This is a more practical question about adaptive control for embedded systems, but still a math question. 
I have tried to apply matrix algebra for subspace identification onto an embedded system. It did work, but I consumed all RAM memory at once. I tested it on a STM32F401RE micro controller that have 96 kBytes of RAM. In practice, a 100*100 hankel matrix, which are often used in subspace identification methods, it will be 100*100*8 = 80 kBytes, due to 8 is the size of the datatype double. Double takes 8 bytes because double precision is required when it comes to subspace identification. Even if I used float, it will be 100*100*4 = 40 kBytes and I have 96 kBytes in RAM. 
So matrix algebra is not a good idea for embedded systems. 
Another method that I don't have tried on embedded systems is the recursive least square (RLS) method. The only use for RLS is for stochastic systems e.g fast systems. Systems that "move a lot" under a short amount of time. If RLS is estimated on perfect controlled system, it will estimate a bad mathematical model and further it will cause instability due to the lack of volatility in the dynamical system. The benefit with RLS is it can be applied to an embedded system e.g Real-Time system.
But what if I have a first order or a high damped second order system that looked like this picture below. It represent a slow system such as water level control or temperature control.
Questions:


*

*Which estimation method can be used for estimating models for deterministic systems e.g slow systems, and that method can also be applied onto an embedded system?

*Which controller can be used to tune in the dynamical system and make it follow a reference point? Assume that we know a SISO transfer function of the current dynamical system. 
The reason why I think transfer functions will be in better use than state space representations in embedded systems, is due to the limited RAM. 
Edit:
Do you think this linear least square method will work for estimating the parameters for a discrete ordinary differential equation, which can be transformed easily into a discrete transfer function.
$$\hat \theta = (\Theta^T \Theta + rI)^{-1}\Theta^T y(k)$$
Where $r$ is a tuning parameter, which will be in practice set to a very low number. It's because so $\Theta^T \Theta$ can always be inverted.
If I got the parameters, the model in other words. What can I use then for find my inputs? Which controller can I use? Assume that I want prediction too. 

 A: Note that there are basically two adaptive approaches: direct and indirect. With the indirect one, you estimate the model parameters, and then you design the control as if the system is known. With the direct one, you do not care about the parameters, and you directly tune the controller to ensure the desired behavior, e.g., reference tracking. 
If the goal is only to follow the desired trajectory, then probably you can apply the direct adaptive model-reference control. 
If the system repetitively executes the same task, then probably you should think about iterative control.
However, if you also want to estimate the model parameters for further prediction, you should use the indirect adaptation. As far as I see it form the figure, it is not reasonable to estimate a second-order model here, unless you have some parameters known, i.e. the white-box model. Assuming the first-order model, we have two parameters. To estimate these parameters, the system must be sufficiently excited, and in your case, it holds only during the transient, i.e. if the system has arrived to the desired position, you cannot estimate two parameters since the system does not move.
It seems two me that any RLS with some forgetting should perfectly work here. You apply the estimation procedure during the transient, you obtain some (hopefully nice) estimates, and then you compute your controller. Probably, you need to run the estimation procedure only once if you do not expect that the parameters vary. 
However, since the problem you describe is rather general, the answer is very general too; it is hard to give some precise advice when the exact engineering problem statement is not known. 
