?? sldemo_absbrakeplots_digest_solver_selection.m
字號:
%RUNABS script which loads and runs the model absbrake
% RUNABS when typed at the command line, loads the model
% and plots the results.
%
% See also ABSDATA
% Author(s): L. Michaels, S. Quinn, 12/1/97
% Copyright 1990-2005 The MathWorks, Inc.
% $Revision: 1.1.6.5 $
%
% Open the absbrake model, and run the simulation until the vehicle stops.
% Try to be a little robust here, if the simulation fails try loading the
% model data again, it may have been cleared from the workspace.
%
% sldemo_absbrake
% try
% time = sim('absbrake',25);
% catch
% absdata
% time = sim('absbrake',25);
% end
%
h = findobj(0, 'Name', 'ABS Solver');
if isempty(h),
h=figure(... %'Position',[26 239 452 257],...
'Name','ABS Solver',...
'NumberTitle','off');
end
figure(h)
set(h,'DefaultAxesFontSize',8)
logsout.unpack('all');
%plot time step size
subplot(3,1,1)
plot(tout(2:end),diff(tout))
title(['Model Step Size, ' 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);
% Plot wheel and vehicle speed comparison
ax2=subplot(3,1,3);
plot(Vs.Time, Vs.Data);
set(findobj(ax2,'type','line'),'color',[0 1 0]);
hold on;
plot(Ww.Time, Ww.Data);
title('Vehicle speed and wheel speed');
ylabel('Speed(rad/sec)');
xlabel('Time(secs)');
%set(gca,'Position',[0.1300 0.1500 0.7750 0.750]);
set(get(gca,'xlabel'),'FontSize',10);
set(get(gca,'ylabel'),'FontSize',10);
set(get(gca,'title'),'FontSize',10);
% Plot arrow with annotation
hold on
% plot([5.958; 4.192],[36.92; 17.29],'r-',[5.758; 5.958; 6.029],[36.55; 36.92; 35.86],'r-' )
% text(8.533,54.66,'Vehicle speed (\omega_v)','FontSize',10)
% plot([7.14; 8.35],[43.1; 56.3],'r-',[7.34; 7.14; 7.07],[43.4; 43.1; 44.1],'r-' )
% text(4.342,15.69,'Wheel speed (\omega_w)','FontSize',10)
legend('Vehicle speed (\omega_v)','Wheel speed (\omega_w)')
drawnow
hold off
% h = findobj(0, 'Name', 'ABS Slip');
% if isempty(h),
% h=figure('Position',[486 239 452 257],...
% 'Name','ABS Slip',...
% 'NumberTitle','off');
% end
% figure(h);
% set(h,'DefaultAxesFontSize',8)
%slp = logsout.slp.Data;
%time = logsout.slp.Time;
% plot wheel slip data
ax2=subplot(3,1,2);
plot(slp.Time,slp.Data);
title('Slip')
xlabel('Time(secs)')
ylabel('Normalized Relative Slip')
%set(gca,'Position',[0.1300 0.1500 0.7750 0.750])
set(get(gca,'xlabel'),'FontSize',10)
set(get(gca,'ylabel'),'FontSize',10)
set(get(gca,'title'),'FontSize',10)
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);
%% Save off wheel speed with solver name attached
solver = get_param(bdroot,'Solver');
data.Ww.(solver) = Ww.copy;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -