MATLAB can't compute a closed-loop final-value theorem on a controller.

25 visualizzazioni (ultimi 30 giorni)
Hi, I have an assignment where I need to design a state-feedback controller in the form: u(k) = K x[k]+ Sy¯[k], with a sampling period pi = 0.05, such that the (discrete-time) closed-loop poles are placed in 0:8 ± 0:1i and the static gain from y¯ to y is 1.
I need to plot a response of the open-loop system to a step of u(t), (which I did)
And 1 plot of the closed-loop response to a step of y¯(t), (doesn't accept S-value, calls it infinite or NaN)
The image below is the initial state-space model:
Here's my code so far:
Phi = [-0.12 0; 5 0]
Gamma = [2.25; 0]
C = [0 1]
D = 0
Pd = ss(Phi, Gamma ,C, D, 0.05)
step(Pd) %plotting the open-loop u(t)
K = [0.45333 -0.00071] %solved K by hand, also had to write down functions so paper is my go to.
PhiCL = Phi+Gamma*[k1 k2]
GammaCL = Gamma *[ s1 ];
syms s1 z;
%MATLAB doesn't compute Z-transform either, tried it by hand, the whole function yields 0
Zg = (C+D*K) * inv(z*eye (2) - PhiCL ) * GammaCL + D*[ s1 ]
Zlim = subs (Zg , z, 1)
s_val = solve (Zlim ==1 , s1) %can't solve fo s1, says: "Empty sym: 0-by-1"
y_bar = ss(PhiCL, GammaCL, (C+D*K), D*s1, 0.05)
%Error using ss (line 284)
%The "B" matrix must be a numeric array with no Inf's or NaN's.
I plotted the y_bar by removing the s1's from D*s1 and GammaCL, and I'm not sure if it converges to 0, I'll attach the plot below. I'm kind of cheating with this plot, and I have to get full points on this assignment or I can't enter the exam.
Thank you in advance!
  2 Commenti
Marjo Toska
Marjo Toska il 4 Giu 2021
Modificato: Marjo Toska il 4 Giu 2021
My big K [k1 k2] was solved for poles [0.8 0.1] since I can't really compute +-0.1i by hand. The results are slightly off by yours I know, but that's not my concern at all. Because Z-transform is always 0 no matter if I use k2=0.1, k2=0.1i or k2=+-0.1i.
I'm concerned with plotting the closed-loop response, and I'm not sure how to do that, have a feeling that Z transform should be non-zero to do that, or solve K, setpoint S and observer L for that. shrug
Paul
Paul il 4 Giu 2021
Modificato: Paul il 4 Giu 2021
Not sure what you meant by: "no matter if I use k2=0.1, k2=0.1i or k2=+-0.1i. " The feedback gain matrix has to be real. What's keeping you from solving for the K by hand? The problem would be to find K such that the characteristic equation of Phi + Gamma*K has roots at z = 0.8 +- 0.1*i.

Accedi per commentare.

Risposta accettata

Paul
Paul il 4 Giu 2021
Spostato: Arkadiy Turevskiy il 11 Gen 2024
Is that feedback gain matrix correct? Note that here I'm using K, but the code above used k1 and k2, which were not defined.
Phi = [-0.12 0; 5 0];
Gamma = [2.25; 0];
C = [0 1];
D = 0;
K = [0.45333 -0.00071];
eig(Phi + Gamma*K) % doesn't match specifcation 0.8 +- 0.1i, using positive feedback consistent witht the question as asked
ans = 2×1
0.8910 0.0090

Più risposte (0)

Categorie

Scopri di più su Matrix Computations in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by