Linear Simulation Tool Problem

1 view (last 30 days)
Hello,
I am trying to produce graphs showing me how my state-space model responds to a sine function.
Unfortunately when using the Linear Simulation Tool, importing the system G and trying a linear analysis with time t = [0:0.1:10] and signal u=sin(t).
The program tells me "None of the systems have a complete set of inputs." Is there a way to solve this?
Regards,
Maxence
Here is my code:
% A, B, C, D Matrices %
A = [0 0 0 1 0 0 0 0 0 0 0 0;
0 0 0 0 1 0 0 0 0 0 0 0;
0 0 0 0 0 1 0 0 0 0 0 0;
0 0 0 -0.0855 0 0 0 -9.81 0 0 0 0;
0 0 0 0 -0.0855 0 9.81 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 1 0 0;
0 0 0 0 0 0 0 0 0 0 1 0;
0 0 0 0 0 0 0 0 0 0 0 1;
0 0 0 0 0.7415 0 0 0 0 0 0 0;
0 0 0 0.7415 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0];
B = [0 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0;
0 0 0 0;
-0.01435 -0.01435 -0.01435 -0.01435;
0 0 0 0;
0 0 0 0;
0 0 0 0;
0 -124.4 0 124.4;
124.4 0 -124.4 0;
-0.01999 0.01999 -0.01999 0.01999];
C = [1 0 0 0 0 0 0 0 0 0 0 0;
0 1 0 0 0 0 0 0 0 0 0 0;
0 0 1 0 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0 1 0 0 0];
D = 0;
G = ss(A, B, C, D);
I = tf(G);

Accepted Answer

Star Strider
Star Strider on 17 Mar 2019
This works for me:
t = 0:0.1:10;
u = ones(size(B,2),1)*sin(t);
y = lsim(G, u', t);
figure
plot(t, u, '--')
hold on
plot(t, y)
hold off
grid
Experiment to get the result you want.
  4 Comments
Maxence Luneau
Maxence Luneau on 28 Mar 2019
Hello again,
I'm stil a struggling a bit with Matlab and Simulink trying to combine both to implement a PID Controller to my state space model.
Using the same matrices A, B, C, D to give me a 4x4 state space model which I can transform into a series of transfer functions. I understand that for my PID controller analysis I need to decouple my model to be able to select 1 dimension, 1 control input of motion to give me 1 output for me to analyse this with a PID controller.
Another difficulty is how do I define the error and gains I need to render my model stable: which is the objective of this exercice. I have found some values of static gain although I do not know how they connect to my model and where I should implement these after.
On another note, I am confused between the difference between the tf and ss2tf functions.
Coming back to simulink, how do I simplify my model for it to hold true and facilitate a Simulink analysis?
If you could elaborate, or give me any advice/information, I would be extremely grateful!
Cheers
Star Strider
Star Strider on 29 Mar 2019
I have not done anything with Simulink in a long time, so I cannot help you with it.
If possible, do everything in state space. It is much easier. I have no idea how you are supposed to approach this problem, however pole placement, state feedback, and such in state space is preferable. With respect to the tf and ss2tf functions, tf accepts numerator and denominator polynomials to produce a system object defined initially by a transfer function. The ss2tf function converts a state space model to a transfer function model. You can find good descriptions of that process in all good modern control textbooks. (I prefer state space for many reasons, some of which I mentioned here. I do not remember much about classical control.)

Sign in to comment.

More Answers (0)

Categories

Find more on Dynamic System Models in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!