[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
help with code system response state space
From: |
Beginner1 |
Subject: |
help with code system response state space |
Date: |
Tue, 9 Jan 2018 04:20:53 -0700 (MST) |
Hi!
I am a very beginner in Octave. I need your help in the following task:
I need to obtain and plot the step response of a system whose state-space
matrices are known and it can be represented by
xdot=A*x+B*u
y=C*x+D*u
For this purpose, I have written this code:
/%State-space system parameters
w=314.159;
ki=1.5;
kp=5000;
A=[0 1 0 0 0 0; 0 0 1 0 0 0; 0 -4*w^2 0 0 0 0;0 0 0 0 1 0;0 0 0 0 0 1;0 0 0
0 -4*w^2 0];
B=[0 0 0 0 0 0; 0 0 0 0 0 0;0 0 -1 0 1 0;0 0 0 0 0 0;0 0 0 0 0 0;0 0 0 -1 0
1];
C=[2*(w^2)*ki 0 ki 0 ki*w 0;0 ki*w 0 2*(w^2)*ki 0 ki];
D=[1 0 -kp 0 kp 0;0 1 0 -kp 0 kp];
%Perform system simulation
stname = {'xd1', 'xd2', 'xd3','xq1','xq2','xq3'};
sys = ss (A, B,C,D,'stname', stname)
t=linspace(0,3,1000)
[y,t,x]=step(sys)
plot(t,y)
/
However, an error message is obtained at the console for the command
plot(t,y) saying that the dimensions of one of the plot arrays are not
correct.
Any suggestion?
Thanks
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
- help with code system response state space,
Beginner1 <=