【发布时间】:2015-06-14 09:51:02
【问题描述】:
我试图在我的 m 文件中使用这个函数,但我得到一个错误(有问题提到)。一切似乎都是正确的,并且在我的 m 文件中定义了 a、b 和 c。有什么想法吗?
错误:
Error in modal2 (line 8)
[v,an]=eig(a);
Output argument "am" (and maybe others) not assigned during call to "C:\Users\Cena\Desktop\Thesis\My Codes\SMC\modal2.m>modal2".
function [r,am,bm,cm] = modal2(a,b,c)
% this function determines the modal representation 2(am,bm,cm)
%given a generic state-space representation (a,b,c)
%and the transformation r to the modal representation
%such that am=inv(r)*a*r, bm=inv(r)*b and cm=c*r
%transformation to complex-diagonal form:
[v,an]=eig(a);
bn=inv(v)*b;
cn=c*v;
%transformation to modal form 2:
i = find(imag(diag(an))');
index = i(1:2:length(i));
j=sqrt(-1);
t = eye(length(an));
if isempty(index)
am=an;bm=bn;cm=cn;
else
for i=index
t(i:i+1,i:i+1)=[j 1;-j 1];
end
%Modal transformation
r=v*t;
end
【问题讨论】:
-
您是否创建了自己的
eig.m来遮盖内置的?which eig返回什么? -
内置 (D:\Program Files\MATLAB\R2012a\toolbox\matlab\matfun\@single\eig) % 单一方法
-
现在重新阅读错误信息我真的很困惑。输出参数称为
an,但错误说明了am。一开始没看出差别。不知道这里发生了什么。 -
我没有创建 ant 'eig.m' 文件@Daniel
标签: matlab