# How can I represent this state space in MATLAB Code?

3 views (last 30 days)
taleem mat on 26 Jan 2022
Commented: Les Beckham on 27 Jan 2022
% Code
A=[ 0 1 0 0 ;
0 0 -7sin(0.05) 0;
0 0 0 1;
0 0 0 -38;];
B=[ 0 0 0 71]';
c=[1 0 0 0];
f=ss(A,B,C,D);
close loop=feedback(f,1)
Is this representation of the state space with sine in it is true ?

Les Beckham on 26 Jan 2022
Edited: Les Beckham on 26 Jan 2022
You need to replace 7sin(0.05) with 7*sin(0.05).
Also, Matlab variable names can't have a space in them so close loop is not a valid variable name.
And your definition of C was in lower case.
And you didn't define D;
A = [ 0 1 0 0 ;
0 0 -7*sin(0.05) 0;
0 0 0 1;
0 0 0 -38;];
B = [0 0 0 71]';
C = [1 0 0 0];
D = 0; % Assuming no direct effect of the input on the output
f=ss(A,B,C,D);
closed_loop=feedback(f,1)
closed_loop = A = x1 x2 x3 x4 x1 0 1 0 0 x2 0 0 -0.3499 0 x3 0 0 0 1 x4 -71 0 0 -38 B = u1 x1 0 x2 0 x3 0 x4 71 C = x1 x2 x3 x4 y1 1 0 0 0 D = u1 y1 0 Continuous-time state-space model.
Les Beckham on 27 Jan 2022
My pleasure