# nonlinear variable state space observer pole placement

2 views (last 30 days)

Show older comments

Hi,

i want to place some observer poles in dependency of an variable. The variable v is speed and it is changing with the time.

Example:

- option

syms v

A = [-1 2; v -1]

c = [0 1]

p = [-2; -3];

so,

L = place(A',c',p).'; %doesnt work

-----------

2.option

syms v lambda l1 l2

L =[l1;l2];

solve((det(lambda * [1 0; 0 1] - (A - L*c)) == (lambda+2)*(lambda+3)),[l1 l2]); %matlab doesn't eliminate lambda

l1 = ?

l2 = ?

do i need to calculate the det matrix by myself or can matlab help me in a faster way?

Thanks and Regards

Bernd

##### 0 Comments

### Accepted Answer

Paul
on 16 Nov 2022

Hi Bernd,

Matlab assumes by default that all sym variables are complex, and this assumption can sometimes lead to unexpected results.

Your code works if we explicitly assume that v and the estimator gains are real (my experience is to include all relevant assumptions)

syms v l1 l2 real

syms lambda

A = [-1 2; v -1];

c = [0 1];

p = [-2; -3];

L = [l1;l2];

sol = solve((det(lambda * [1 0; 0 1] - (A - L*c)) == (lambda+2)*(lambda+3)),[l1 l2]) %matlab doesn't eliminate lambda

If v == 0, then A,C are not an observable pair, so we should exclude v == 0 from the analysis

assumeAlso(v ~= 0);

sol = solve((det(lambda * [1 0; 0 1] - (A - L*c)) == (lambda+2)*(lambda+3)),[l1 l2])

Or more compactly without hardcoding anything

sol = solve(det(lambda*eye(2)- (A - L*c)) == poly2sym(poly(p),lambda),L)

Or, using Ackerman's formula

alpha(lambda) = poly2sym(poly(p),lambda)

O = [c ; c*A];

(A^2 + 5*A + 6*eye(2))*inv(O)*[0;1]

##### 11 Comments

Paul
on 27 Nov 2022

### More Answers (1)

Sam Chak
on 16 Nov 2022

Edited: Sam Chak
on 16 Nov 2022

Long time I didn't solve math puzzles like this one. Generally, you should be able find the analytical solution for L that satisfies the condition of eigenvalues of that gives and .

The following is an attempt to solve the problem heuristically for . You can attempt for .

v = 1:10;

c = [0 1];

p = [-2; -3];

for j = 1:length(v)

A = [-1 2; v(j) -1];

L = place(A', c', p) % always return L = [m 3]

m(j) = L(:, 1);

end

plot(v, m, 'p'), xlabel('v'), ylabel('L_1')

The pattern can be intuitively recognived as:

vv = linspace(1, 10, 901);

L1 = (4 + 2*(vv - 1))./vv;

plot(vv, L1), grid on, xlabel('v'), ylabel('L_1')

##### 2 Comments

Sam Chak
on 18 Nov 2022

Edited: Sam Chak
on 18 Nov 2022

For implementation in Simulink, both equations for are exactly the same (for your original 2nd-order system):

My equation came from my recognition of the numerical pattern as something related to the arithmetic sequence (without employing the curve-fitting tool), while Paul's equation is the solution as a direct result from his analytical mind and the computational power of MATLAB.

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!