📄 xxxt.m
字号:
%用户分别输入多变量系统的A,B矩阵global n1 n2 k1n1=input('please input the length of A\n');n2=input('please input the length of column of B\n');for i=1:n1 for j=1:n1 A(i,j)=input('please input a number for A in row\n'); endendfor i=1:n1 for j=1:n2 B(i,j)=input('please input a number for B in row\n'); endend%判断系统(A,B)是否能控Qc=[B];for i=1:n1-1 Qc=[Qc A^(i)*B];endif rank(Qc)==n1 disp('the system is controllable'); %显示结果:系统是可控的else disp('the system is uncontrollable'); %显示结果:系统是不可控的end%通过特征根是否互异,判断A矩阵是否为循环矩阵d=eig(A)for i=1:n1-1 if d(i+1)==d(i) disp('A is not a circle matrix\n'); [A1]=f1(A); break endenddisp('A is a circle matrix\n');[A1]=f2(A);p=fix(10*rand(n2))B1=B*p; %将多变量系统极点配置转化为单变量极点配置%输入期望极点for i=1:n1 lambda(i)=input('please input the expected pole');end%计算单变量系统的极点配置k2=place(A1,B1,lambda)disp('the state(A,B) feedback matrix is') %显示结果:系统(A,B)的极点配置的状态反馈矩阵k=p*k2+k1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -