help with code system response state space

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

help with code system response state space

Beginner1
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-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: help with code system response state space

Doug Stewart-4


On Tue, Jan 9, 2018 at 6:20 AM, Beginner1 <[hidden email]> wrote:
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



did you try 

step(sys)
 
DAS


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

RE: help with code system response state space

Beginner1

Hi!

Thank you for your answer. I have just tried your proposal but an error again appears:

 

error: invalid use of script D:\Users\108907\step.m in index expression

error: called from

    state at line 20 column 1

 

And I need also to plot the response and to add initial conditions for x and y vectors

 

Any suggestion?

 

 

De: Doug Stewart [mailto:[hidden email]]
Enviado el: martes, 09 de enero de 2018 15:23
Para: Haro Larrode, Marta Emilia
CC: Help GNU Octave
Asunto: Re: help with code system response state space

 

 

 

On Tue, Jan 9, 2018 at 6:20 AM, Beginner1 <[hidden email]> wrote:

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

 

did you try 

 

step(sys)

 

DAS

 


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: help with code system response state space

Doug Stewart-4


On Tue, Jan 9, 2018 at 9:30 AM, Haro Larrode, Marta Emilia <[hidden email]> wrote:

Hi!

Thank you for your answer. I have just tried your proposal but an error again appears:

 

error: invalid use of script D:\Users\108907\step.m in index expression

error: called from

    state at line 20 column 1

 

And I need also to plot the response and to add initial conditions for x and y vectors



I tried your code with step(sys) and it works for me.

What OS are you using?
What version of octave are you using?
what version of control do you have?

Doug


 

 

Any suggestion?

 

 

De: Doug Stewart [mailto:[hidden email]]
Enviado el: martes, 09 de enero de 2018 15:23
Para: Haro Larrode, Marta Emilia
CC: Help GNU Octave
Asunto: Re: help with code system response state space

 

 

 

On Tue, Jan 9, 2018 at 6:20 AM, Beginner1 <[hidden email]> wrote:

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

 

did you try 

 

step(sys)

 

DAS

 




--
DASCertificate for 206392


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

RE: help with code system response state space

Beginner1

OS: Windows 7 professional copyright 2009 Service Pack 1

Octave version: 4.2.1

Control version: control 3.0.0

 

Kind regards

 

De: Doug Stewart [mailto:[hidden email]]
Enviado el: martes, 09 de enero de 2018 15:43
Para: Haro Larrode, Marta Emilia
CC: Help GNU Octave
Asunto: Re: help with code system response state space

 

 

 

On Tue, Jan 9, 2018 at 9:30 AM, Haro Larrode, Marta Emilia <[hidden email]> wrote:

Hi!

Thank you for your answer. I have just tried your proposal but an error again appears:

 

error: invalid use of script D:\Users\108907\step.m in index expression

error: called from

    state at line 20 column 1

 

And I need also to plot the response and to add initial conditions for x and y vectors

 

 

I tried your code with step(sys) and it works for me.

 

What OS are you using?

What version of octave are you using?

what version of control do you have?

 

Doug

 

 

 

 

Any suggestion?

 

 

De: Doug Stewart [mailto:[hidden email]]
Enviado el: martes, 09 de enero de 2018 15:23
Para: Haro Larrode, Marta Emilia
CC: Help GNU Octave
Asunto: Re: help with code system response state space

 

 

 

On Tue, Jan 9, 2018 at 6:20 AM, Beginner1 <[hidden email]> wrote:

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

 

did you try 

 

step(sys)

 

DAS

 



 

--

DASCertificate for 206392

 


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: help with code system response state space

Doug Stewart-4


On Tue, Jan 9, 2018 at 9:50 AM, Haro Larrode, Marta Emilia <[hidden email]> wrote:

OS: Windows 7 professional copyright 2009 Service Pack 1

Octave version: 4.2.1

Control version: control 3.0.0

 

Kind regards




does this work for you?

num=10
den=poly([-2 -3+3j  -3-3j])
sys=tf(num,den)
step(sys)

 

 

--

DASCertificate for 206392

 




--
DASCertificate for 206392


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave