我有一个程序,用于计算原始系统中的CPU时间和最小的CPU时间。假设CPU_minimum< CPU_original 但在我的情况下发生相反的情况。这是代码
clear
load('C.mat');
load('G.mat');
% start of simulation time for the original state-space model
tic;
t1 = cputime;
A = -C\ G;
BB=sparse(280,4);
BB(4,1) = 1;
BB(6,2)= 1;
BB(43,3)=1;
BB(72,4) = 1;
%disp(BB);
B = C\BB;
C=B';
D =zeros(4,4);
sys1 = ss(A,B,C,D)
totalCPUTime1 = cputime-t1
fprintf ( 1, 'Creation of the original state-space model needs %1.3f
seconds the CPU.\n', totalCPUTime1 )
% end of simulation time for original state-space model
first = toc
% start of simulation time for the minimum state-space model
tic;
t2 = cputime;
syss1 = minreal(sys1)
totalCPUTime2 = cputime-t2
fprintf ( 1, 'Creation of the minimum state-space model needs %1.3f
seconds the CPU.\n', totalCPUTime2 )
% end of simulation time for minimum original state-space model
second = toc
我得到以下CPU时间:
totalCPUTime1= 3.744
totalCPUTime2= 9.641
你知道问题出在哪里吗?