Matrix Size Error using LQR

조회 수: 8 (최근 30일)
Jack Murphy
Jack Murphy 2020년 10월 26일
댓글: Jack Murphy 2020년 10월 26일
Hello,
I'm trying to calculate the observer ( L ) matrix of the following state-space system using the LQR command. When I run the code, I get the error "Error using lqr (line #) the R matrix must be square of size 1". I understand the error, but in my code I have an R matrix that IS size 1, so i'm unsure where the error is coming from. Ideally, once I find the L matrix I can calculate the transfer function of the system and make a bode plot.
Here is my code
A = [0 1; 0 0];
B = [0 ; 42.8625];
C = [1 0];
D = [0];
K = [1.8 0.25];
Q = [100 0; 0 10];
R = [1];
L = lqr(A',C',inv(R),inv(Q))'
%Error using lqr (line #)
%The R matrix must be square of size 1.
Thanks
  댓글 수: 1
Jack Murphy
Jack Murphy 2020년 10월 26일
Ah, I have my Q and R matrices confused while using the LQR command, so Q needs to be a square matrix of size 1.

댓글을 달려면 로그인하십시오.

답변 (0개)

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by