# how to handle state space model where stats are multiplied by inputs ?

37 views (last 30 days)
Asser Mohamed on 8 Apr 2020
Answered: Ameer Hamza on 11 Apr 2020
I am having trouble modelling a state space model where the states and inputs are multiplied together.
Consider this example:
Xdot = X*sin(u)
This is a simplified example but it covers my problem. Here X represents the state and u the input. They are multiplied together.
How can I separate them into
Xdot= Ax+Bu
My approach was to linearize the model by taking partial derivative with respect to U. But this way the equation will be a constant multiplied by U.
Xdot = Bu
But this way it will not depend on X which I find intuitively not correct.
Can someone give me help ?
darova on 10 Apr 2020
How to know u(i) for this?
dx(i) = A*x(i) + B*u(i);
x(i+1) = x(i) + dx(i)*dt;

Ameer Hamza on 11 Apr 2020
"But this way it will not depend on X which I find intuitively not correct."
It is possible for a linearized model to depend only on its input, and it does make sense. Note that the linearized model is not equivalent to the nonlinear model. It is just its approximation in a small region around the linearization point. The linear model you have written in the question is not calculated correctly. You need to take partial derivative w.r.t. both X and U to get a linearized model. Suppose you want to linearize your system around , , then linear model is calculated like this Drop δ to simplify the notation As you can see, the coefficient A and B of the linearized system are not constant. They are themself dependent on the current value of and . You need to calculate A repeatedly at each time-step to get a good linear approximation Now suppose you linearize the system around and . The linearized model will become This is exactly the situation you mentioned in your question. But remeber that since this is a linearized model, so if you have a finite value for input u, then will be finite and after one time-step you will have a different linearization point, ( , ) and you will re-calculate A and B.
How to handle such models in MATLAB:
MATLAB provides tools to handle such a nonlinear state-space model using a generic ODE solver, e.g., ode45. It will automatically linearize the model. The following shows an example
ode45(@f, [0 10], 0.1); % 0.1 is the initial condition for the value of x
function dxdt = f(t, x)
u = 1; % constant input
dxdt = x*sin(u)
end