getting error of matrix dimension
8 ビュー (過去 30 日間)
古いコメントを表示
Hello
Trying to use kalman command and getting error in designing of weighting matrix QN.
i am getting following error
Error using horzcat
CAT arguments dimensions are not consistent.
Error in LQG_controller_mat (line 28)
QN=[QW f]
my code is
************************
clear all; clc; close all
load sec_sumsin_ABCDmatrix.mat % data As,Bs,Cs,Ds
syss=ss(As,Bs,Cs,Ds,0.001);
syssc=d2c(syss,'tustin'); % convert from discrete to continuous
[Asc,Bsc,Csc,Dsc]=ssdata(syssc);
nx=10; % states
ny=1; % output
nu=1; % input
M=diag([1.8108e0*ones(1,ny)]);
QX=Csc'*M*Csc;
QU=diag([3.9805e-8*ones(1,nu)]);
Kc= lqr(syssc,QX,QU)
QW=1*eye(nx);
f=zeros(1,nx);
QN=[QW f]
QV=1*eye(ny);
g=zeros(1,nx);
RN=[QV g]
L= kalman(syssc,QN,RN)
0 件のコメント
回答 (1 件)
Image Analyst
2013 年 3 月 19 日
You need to learn how to use the debugger. Set a breakpoint on this line:
QN=[QW f];
Then when it stops there, type this into the command window:
size(QW)
size(f)
The first number that it prints out for each is the number of rows in that variable. The rows must have the same value or else you can't stitch those arrays together horizontally.
2 件のコメント
Image Analyst
2013 年 3 月 19 日
I don't know what all those variables are supposed to mean and how kalman interprets them. All I know is that you can't stitch a 1 row matrix side by side with a 10 row matrix. I think you need to understand what's going on and not just change some f variable to allow the stitching to work when that might break something else that depends on f being 1 row tall.
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!