作者manflavor (BB)
看板MATLAB
标题[讨论] 在simulink function中如何使用lqr指令
时间Mon Aug 31 18:57:47 2015
小弟我在simulink中matlab function中打了以下程式码
输入u为一个数字
输出Kopt为矩阵
程式码如下
function Kopt = fcn(u)
A =[-0.2331 0.1635 0 0 0.0075 0;
0.1635 -0.1710 0 0 0 0.0075;
0 0 -0.2257 0.1635 0 0;
0 0 0.1013 -0.1013 0 0;
0.0001 0 0 0 -0.0041 0;
0 0.0001 0 0 0 -0.0041;]
B =1000*[ -0.7884 -2.3757 0;
-0.0053 -0.0053 0;
0.0000 -0.0000 0.0001;
0.0000 0.0000 0;
0.0010 0.0010 0;
0.0010 0.0010 0;]
Ropt=[1.8e8 0 0;
0 1.8e8 0;
0 0 1.8e8;]
Qopt=[u 0 0 0 0 0;
0 1 0 0 0 0;
0 0 1 0 0 0;
0 0 0 1 0 0;
0 0 0 0 0 0;
0 0 0 0 0 0;]
Kopt=lqr(A,B,Qopt,Ropt)
可是系统都会显示
The function 'lqr' is not supported for standalone code generation.
See the documentation for coder.extrinsic to learn how you can use this
function in simulation.
是在simulink function中
lqr指令不能用吗
因为小弟把这段程式码打在一般m file中可以执行
是哪里有问题呢
小弟愿以1000P币答谢
感谢大家了
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.116.155.120
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MATLAB/M.1441018671.A.450.html
1F:推 yihow: 我也想知道... 09/01 16:52
2F:推 weinottm: Iqr 要有安装对应的toolbox才能用 那讯息就是没装 09/03 06:08
楼上可是我在一般的M FILE打lqr可以执行欸 是因为simulink内的embedded matlab
function可执行的东西跟一般m file不一样吗?
※ 编辑: manflavor (140.116.155.120), 09/03/2015 13:48:32