getLoopTransfer is giving the same open loop transfer functions for two different systems
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
I have two separate systems and I am using slLinearizer and getLoopTransfer function to get the open loop transfer functions at the input of the plant (u) for both the systems. Although, the plant dynamics are same, but the controllers are designed differently. Still, getLoopTransfer function gives the same open loop function for both the systems.
CL_lqr = slLinearizer(mod_lqr);
addPoint(CL_lqr,'u')
Li_lqr = getLoopTransfer(CL_lqr, 'u', -1);
CL_lqg = slLinearizer(mod_lqg);
addPoint(CL_lqg,'u')
Li_lqg = getLoopTransfer(CL_lqg, 'u', -1); % result same as Li_lqr

System 2:

When I manually open the loop at 'u' for the 2nd system and linearize it, the result is a different open loop transfer function which seems correct.
Li_lqg = linearize(mod_lqg);

What could be the reason for the difference in the results? I have tried different ways of troubleshooting, I think getLoopTransfer function works differently than linearizing the model by putting in and out ports.
채택된 답변
Hi Janki,
I'd have to go through the math on the two calls to getLoopTransfer to determine if that result makes sense. Offhand, it doesn't sound like those two results should be the same, unless the estimator gain matrix, L, in the Kalman Filter block is zero (I'm assuming that block is really an ordinary Luenberger observer). Can you show a screen capture of the block paramters dialog for the Kalman Filter block?
The "manual" approach on the call to linearize is not the same as the call to getLoopTransfer on CL_lqg. The latter puts the analysis point at the output of the sum junction to the left of the node that branches off to the Kalman Filter block.
댓글 수: 13
Hi Paul,
Thanks for your answer. I put the in and out ports at the output of the sum junction to the left of the node and linearized the model and it indeed matches with your explanation about the getLoopTransfer function. Yes, it is an ordinary state estimator, I get the gains using the kalman function in MATLAB.

How could I use the getLoopTransfer function to break the loop to the right of the node instead?
"How could I use the getLoopTransfer function to break the loop to the right of the node instead? "
Put a gain block with a gain of 1 at the input to the plant to the right of the node that branches off to the Kalman Filter block. Set the name of the signal output from the gain block to 'u'.
So now all three cases yield the same result? I'll have to think about that some more as it's still not clear to me that should be the case for the problem as described.
Having thought about it some more, I now think that breaking the loop to the left of that node will yield the same OL transfer function Li_lqg as is Li_lqr.
Hi Paul,
"How could I use the getLoopTransfer function to break the loop to the right of the node instead? "
I believe my original query is solved with your answer to the above question. Could you explain to me how breaking the loop to the left of the node will yield the same OL functions?
It can be proved symbolically.
I just posted this question, wherein LHS is the symbolic form of Li_lqg and RHS is the symbolic form of Li_lqr, but assuming the integral gain is zero (becuase that loop is the same for both cases) and ignoring the state feedback gain, because that just premultiplies both expressions.
I think there should be a more elegant approach than I posted there. I'm sure there is, it's just a matter of finding and applying the proper matrix identities.
Okay, makes sense. Thank you for your help.
I have one more question if you could help me with it. When I break the loop at the output n_z for both the systems, the loop transfer functions are the same. Why is that? I am attaching a snapshot of the result. The above transfer function is for the LQG system and the one below is for the LQR.

Can you save to a .mat file the A,B,C,D matrices of the plant, the state feedback gain K, the estimator gain L, and the integral gain Ki and then upload the .mat file using the paperclip icon on the Insert ribbon? I'd like to try to recreate your results.
Yes, here you go.
I'm not sure I'm modeling the system correctly, but as I've done it I don't see the same open-loop transfer function at n_z for the two implementations. Do any of these results match yours?
load mydata
whos
Name Size Bytes Class Attributes
A 3x3 72 double
B 3x1 24 double
C 2x3 48 double
D 2x1 16 double
K 1x3 24 double
Ki 1x1 8 double
L 3x2 48 double
ans 1x35 70 char
cmdout 1x33 66 char
System 1 in the question shows the plant has four outputs. It looks like the first three outputs are the state variables q-pitch rate, alpha - angle-of-attack, and delta_e - elevon deflection. However, the C matrix here only indicates two outputs?
C
C = 2×3
0.1351 9.9137 0.1350
1.0000 0 0
I'll assume that these outputs are y (N_z?) and q and I'll augment the plant outputs to include the state variables.
plant = ss(A,B,[eye(3); C],[zeros(3,1) ; D],'InputName','u','OutputName',{'x1' 'x2' 'x3' 'n_z' 'q'});
gain = ss(1,'InputName','uc','OutputName','u');
Kc = ss(K,'InputName',{'x1' 'x2' 'x3'},'OutputName','Kx');
I = tf(Ki,[1 0],'InputName','e','OutputName','xi');
sum1 = sumblk('uc = xi - Kx');
sum2 = sumblk('e = r - n_z');
CL_lqr = connect(plant,gain,Kc,I,sum1,sum2,'r','n_z',{'u' 'uc' 'n_z'});
Warning: The following block outputs are not used: q.
Li_lqr = getLoopTransfer(CL_lqr,'n_z',-1);
estimator = ss(A-L*C,[B L],eye(3),zeros(3),'InputName',{'uc' 'n_z' 'q'},'OutputName',{'xhat1' 'xhat2' 'xhat3'});
Kc = ss(K,'InputName',{'xhat1' 'xhat2' 'xhat3'},'OutputName','Kxhat');
sum1 = sumblk('uc = xi - Kxhat');
CL_lqg = connect(plant,gain,Kc,I,sum1,sum2,estimator,'r','n_z',{'u' 'uc' 'n_z'});
Warning: The following block outputs are not used: x1,x2,x3.
Li_lqg = getLoopTransfer(CL_lqg,'n_z',-1);
Compare closed-loop transfer functions
zpk(minreal(ss(CL_lqr)))
ans =
From input "r" to output "n_z":
-1.9232 (s+17.17) (s-21.08)
------------------------------------------
(s+12.71) (s+2.557) (s^2 + 4.184s + 21.42)
Continuous-time zero/pole/gain model.
zpk(minreal(ss(CL_lqg)))
3 states removed.
ans =
From input "r" to output "n_z":
-1.9232 (s-21.08) (s+17.17)
------------------------------------------
(s+12.71) (s+2.557) (s^2 + 4.184s + 21.42)
Continuous-time zero/pole/gain model.
minreal(zpk(CL_lqg))
ans =
From input "r" to output "n_z":
-1.9232 (s-21.08) (s+17.17)
------------------------------------------
(s+2.557) (s+12.71) (s^2 + 4.184s + 21.42)
Continuous-time zero/pole/gain model.
figure
step(CL_lqr,CL_lqg)

Compare open loop transfer functions at the n_z feedback.
figure
bode(Li_lqr,Li_lqg)

zpk(minreal(ss(Li_lqr)))
ans =
From input "n_z" to output "n_z":
-1.9232 (s+17.17) (s-21.08)
----------------------------------
s (s+12.91) (s^2 + 6.541s + 35.28)
Continuous-time zero/pole/gain model.
zpk(minreal(ss(Li_lqg)))
1 state removed.
ans =
From input "n_z" to output "n_z":
-4.5767 (s-21.08) (s+17.17) (s^2 + 7.573s + 71.12)
--------------------------------------------------------
s (s+14.87) (s^2 + 5.29s + 30.98) (s^2 + 24.59s + 178.4)
Continuous-time zero/pole/gain model.
Thank you for implementing this example. I am getting the same results and your assumption about augmenting the C matrix is also correct. Sorry I did not specify that in my data.
Here, I see that the loop is broken at the n_z feedback (to the kalman filter) in the LQG system. However, I am calculating the OL transfer function at the n_z feedback to the reference. Consider the following image.

If I calculate the OL transfer functions at 'n_z' and 'nz_fb', I get the following results.

I want to know why we get the same results for both the systems when we calculate OL transfer functions at the n_z feedback to the reference. I found an explanation and it says this is because we are essentially isolating the reference tracking loop when we open it and so the behaviour of the controller (whether LQR or LQG) is not manifested in the OL transfer function.
Could you verify this explanation? Also, the inner loops are still closed, then why do we not see the behaviour of the controller?
Consider the plant and estimator dynamics written as follows
xdot = A*x + B*u
y = C*x
ye = y - yhat
xhatdot = A*xhat + B*u + L*ye
yhat = C*xhat
If the input signal, u, is the exact same input that drives the plant AND the initial conditions on x and xhat are the same, then it must be the case that:
x = xhat
y = yhat
i.e., the estimated state output of the estimator is exactly the same as the state output of the plant and the output estimation error, ye, is zero. That's why in the initial problem breaking the loop the left of the node on the input path yielded the same results for both systems. On the output side, the same thing happens when we break the loop at the n_z signal as long as the nz_fb signal is input to the filter. But, when we break the loop at nz_fb, we get a very different system
ye = [0 1]*y - yhat
xhatdot = A*xhat + B*u + L*ye
In this case, the estimator gain is multiplying a non-zero signal (becuase yhat(1) ~= 0) and that will introduce additional dynamics into the open loop system.
If you modify the Simulink model for the lqg case to explicity implement the esimator dynamics as shown above, you can probe the individual signals (y, yhat, ye) and verify. Alterntatively, you could go through all of the block diagram algebra for both cases.
Disclaimer: All of the above is only based on thinking about the problem, strongly advise additional simulation/analysis to verify.
This explanation is clear to me. Thank you for all your help, Paul!
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 State-Space Control Design에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
