查看: 115|回复: 0|关注: 0

[未答复] 急~!Matlab中求逆出现奇异矩阵如何解决

[复制链接]

新手

10 麦片

财富积分


050


1

主题

1

帖子

0

最佳答案
发表于 7 天前 | 显示全部楼层 |阅读模式
function []=neidianfa()%存在的问题在于取的初始点或者初始值及目标值的不准确导致矩阵奇异
clc
clear all

%梯级、抽蓄的联合出力初始插值
for i=1:24
syms x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27
X1=[x1 x2 x3 x4 x5 x6 x7 x8 x9];
X2=[x10 x11 x12 x13 x14 x15 x16 x17 x18];
X3=[x19 x20 x21 x22 x23 x24 x25 x26 x27];
E1=[x1;x2;x3;x4;x5;x6;x7;x8;x9];
E2=[x10;x11;x12;x13;x14;x15;x16;x17;x18];
E3=[x19;x20;x21;x22;x23;x24;x25;x26;x27];
Pmin=[10.5 10.5 10.5 14 14 14 8.4 8.4 8.4];
Pmax=[15 15 15 20 20 20 12 12 12];
k=[15.0000 15.0000 15.0000 10.6381 12.9038 13.9588 15.0000 15.0000 14.1221 15.0000 15.0000 15.0000 15.0000 15.0000 15.0000 13.6832 10.9136 12.3364 15.0000 15.0000 15.0000 15.0000 15.0000 14.6348;
    14.7191 14.9132 14.9137 10.5000 10.5000 10.5000 13.1825 14.1758 10.5000 14.6906 14.1563 14.3438 14.7631 13.6042 12.6895 10.5000 10.5000 10.5000 15.0000 15.0000 15.0000 13.2737 13.0979 10.5000;
    0 0 0 10.5000 10.5000 10.5000 10.5000 10.5000 10.5000 0 0 0 0 0 0 10.5000 10.5000 10.5000 13.7645 12.7620 14.9721 10.5000 10.5000 10.5000;
    20.0000 20.0000 20.0000 20.0000 20.0000 16.8203 15.4643 14.4451 15.3890 14.1514 14.3659 14.8034 16.8966 15.9877 14.0000 20.0000 14.4746 18.5028 19.8701 20.0000 20.0000 17.6703 17.4692 19.4069;
    15.6887 15.5208 14.9817 14.5931 14.0357 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 17.8506 14.0000 14.0000 14.0000 18.9264 18.5340 14.0000 14.0000 14.0000;
    14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000 14.0000;
    8.4000 8.9612 8.5352 8.4000 9.0234 8.4866 12.0000 11.5669 10.5527 11.1194 11.0374 12.0000 12.0000 12.0000 12.0000 10.3140 8.4000 10.4545 10.8274 8.6158 8.8441 8.4000 8.8864 10.1591;
    8.4000 8.4000 8.4000 8.4000 8.4000 8.4000 10.2657 8.4000 8.4000 8.4000 8.4000 8.5080 9.9508 8.9931 9.0728 8.4000 8.4000 8.4000 8.4000 8.4000 8.4000 8.4000 8.4000 8.4000;
    8.4000 8.4000 8.4000 8.4000 8.4000 8.4000 0 0 0 0 0 0 0 0 0 8.4000 8.4000 8.4000 8.4000 8.4000 8.4000 8.4000 8.4000 8.4000];%梯级电站出力初始值9*96矩阵
K=[k k k]+0.5+rand(9,72);%梯级电站出力参考值9*72(288)矩阵
P0=k(:,i);
Pr1=zeros(1,9);
Pr2=zeros(1,9);
Pr3=zeros(1,9);

%互补发电系统的参考出力
Pr1=[K(:,3*(i-1)+1)]';
Pr2=[K(:,3*(i-1)+2)]';
Pr3=[K(:,3*(i-1)+3)]';
A=ones(9,9);

f=X1*A*E1+(X1+X2)*A*(E1+E2)+(X1+X2+X3)*A*(E1+E2+E3)+2*(P0'-Pr1)*E1+2*(P0'-Pr2)*(E1+E2)+2*(P0'-Pr3)*(E1+E2+E3)+3*P0'*A*P0-2*P0'*(Pr1'+Pr2'+Pr3')+Pr1*A*Pr1'+Pr2*A*Pr2'+Pr3*A*Pr3';
disp('内点法:');
disp('目标函数:f');
disp('约束条件:g');
g=[];
G=1e-6*0.1*rand(1,27);
% [x,minf]=minNF(f,[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0],g,10,0.6,[X1 X2 X3]);
[x,minf]=minNF(f,G,g,1,0.6,[X1 X2 X3]);
disp('最小值点 x:')
disp(x)
disp('最小函数值 minf:')
disp(minf)
end

回复主题 已获打赏: 0 积分

举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

快速回复 返回顶部 返回列表