solver_profiling.m

来自「如何利用SIMULINK进行精确的建模」· M 代码 · 共 31 行

M
31
字号
%% Solver Profiling

%% Set the solver to save solver profile info

set_param(bdroot,'SolverProfileInfoName','stat')
set_param(bdroot,'SaveSolverProfileInfo','yes')

%% Display Time step size

h2 = findobj(0, 'Name', 'ABS Time Steps');
if isempty(h2),
  h2=figure(... %'Position',[26   239   452   257],...
           'Name','ABS Time Steps',...
           'NumberTitle','off');
end

figure(h2)

plot(tout(2:end),diff(tout))
title(['Model Step Size' 10 get_param(bdroot,'Solver') ' took ' num2str(length(tout)-1) ' steps'])
ylabel('Step Size(secs)')
xlabel('Time(secs)')
set(get(gca,'xlabel'),'FontSize',10);
set(get(gca,'ylabel'),'FontSize',10);
set(get(gca,'title'),'FontSize',10);

%%
set(gca,'YScale','log')
grid on

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?