[Scilab-users] Xcos-vector size error

simon_46_scilab szymon.gapa at gmail.com
Tue Feb 16 01:45:31 CET 2016


Hi, I am Simon

I am doing some project for my studies. We have to simulate regulation
systems with use of state information (x(t) - from state space). But for
hours I can't manage the problem with vector size I used in simulation.
I have been trying to simulate this model:

<http://mailinglists.scilab.org/file/n4033453/simC.png> 

In this part of project we've got make a model of so called Luenberger
Observer (state observer).

The subsystem looks like this:

<http://mailinglists.scilab.org/file/n4033453/simC_sub.png> 

And in this part the problem appears: the vector after integration doesn't
match to the 'F' gain which is 3x3 matrix. I have been trying many ways to
solve that...

The code-context to this simulation is:


s = poly(0, "s");
numK= 64.75;
b0=numK; b1=0; b2=0;
denK = s^3 + 8*s^2 + 16.25*s + 64.75;
a3=1;   a2=8;    a1=16.25;   a0=64.75;
K=numK/denK;
//r=roots(denK)
//i=%i;
//r1=-7;r2=-0.5+3*i;r3=-0.5-3*i;
A=[0 1 0;0 0 1;-a0 -a1 -a2]; 
b=[0;0;1]
C=[b0,b1,b2];
D=zeros(3,1);


//simA
h=0.01;     //clock period
t=30;       //simulation time
x0=[1;2;3];     //vector of initial condition
c0=eye(3,3);
buf=1280;


//simB      //regulatory normal form
lambda1=4;    //experimentally derived
lambda2=3;
lambda3=-6;
a_z=(s-lambda1)*(s-lambda2)*(s-lambda3); //polynomial of closed system
alfa0=coeff(a_z,0); alfa1=coeff(a_z,1); alfa2=coeff(a_z,2);
alfa3=coeff(a_z,3); //new polynomial coefficients
kr1=alfa0-a0; kr2=alfa1-a1; kr3=alfa2-a2;
k=[kr1; kr2; kr3]; //gain vector

     //Ackermann method
I=eye(3,3);
PHI=A^3+alfa2*A^2+alfa1*A+alfa0*I;
Qc=[b A*b A^2*b];  //matrix of controllability
kAk=([0 0 1]*(Qc)^(-1)*PHI)'; //Ackermann gain vector


// simC
lambda_f1=-15; //exemplary lambda values
lambda_f2=-12;
lambda_f3=-7;
a_f=(s-lambda_f1)*(s-lambda_f2)*(s-lambda_f3);  //observer characteristic
polynomial
alfa_f0=coeff(a_f,0); alfa_f1=coeff(a_f,1); alfa_f2=coeff(a_f,2);
alfa_f3=coeff(a_f,3)
PHIf=alfa_f3*A^3+alfa_f2*A^2+alfa_f1*A+alfa_f0*I;//matrix polynominal
Qo=[C;C*A;C*A^2];//observability matrix
kf=PHIf*inv(Qo)*[0; 0; 1]; //observer gain
F=A-kf*C; //observer matrix

I would be very very greateful for any help or prompt

Simulation file:
simC.zip <http://mailinglists.scilab.org/file/n4033453/simC.zip>  




--
View this message in context: http://mailinglists.scilab.org/Xcos-vector-size-error-tp4033453.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list