Skip to content

Instantly share code, notes, and snippets.

@eldstal
Created February 19, 2013 19:58
Show Gist options
  • Save eldstal/4989322 to your computer and use it in GitHub Desktop.
Save eldstal/4989322 to your computer and use it in GitHub Desktop.
% First, put the curves in place
[AX, H1, H2] = plotyy(N_mark_resolve, D_N_mark_resolve, N_mark_noresolve, D_N_mark_noresolve, 'plot');
set(H1, 'LineStyle', ('-'));
set(H1, 'LineWidth', 2);
set(H1, 'Color', 'g');
set(H2, 'LineStyle', ('--'));
set(H2, 'LineWidth', 2);
set(H2, 'Color', 'k');
set(AX(1), 'YColor', 'k')
set(AX(2), 'YColor', 'k')
hold on;
% Then the ticks for simulator results
[TAX, TH1, TH2] = plotyy(N_sim_resolve, D_N_sim_resolve, N_sim_noresolve, D_N_sim_noresolve);
set(TH1, 'LineStyle', ('none'));
set(TH1, 'marker', ('+'));
set(TH1, 'LineWidth', 2);
set(TH1, 'Color', 'b');
set(TH2, 'LineStyle', ('none'));
set(TH2, 'marker', ('o'));
set(TH2, 'LineWidth', 2);
set(TH2, 'Color', 'r');
set(TAX(1), 'YColor', 'k')
set(TAX(2), 'YColor', 'k')
%{
plot(N_mark_resolve, D_N_mark_resolve, '-g','DisplayName', sprintf('%s, Collision Resolution', marklegend), 'LineWidth', 2);
hold on;
plot(N_sim_resolve, D_N_sim_resolve, '+b','DisplayName', 'Simulator, Collision Resolution', 'LineWidth', 2);
plot(N_mark_noresolve, D_N_mark_noresolve, '--k','DisplayName', sprintf('%s, No Collision Resolution', marklegend), 'LineWidth', 2);
plot(N_sim_noresolve, D_N_sim_noresolve, 'or','DisplayName', 'Simulator, No Collision Resolution', 'LineWidth', 2);
hold off;
%}
set(H1, 'DisplayName', sprintf('%s, Collision Resolution', marklegend));
set(H2, 'DisplayName', sprintf('%s, No Collision Resolution', marklegend));
set(TH1, 'DisplayName', sprintf('%s, Collision Resolution', 'Simulator'));
set(TH2, 'DisplayName', sprintf('%s, No Collision Resolution', 'Simulator'));
l = legend([H1, H2, TH1, TH2], 'Location', 'NorthWest');
hold off;
xl = xlabel('Number of participating users');
%yl = ylabel('Delay (RACH cycles)');
set(get(AX(1),'Ylabel'),'String','Delay (RACH Cycles), Collision Resolution')
set(get(TAX(1),'Ylabel'),'String','Delay (RACH Cycles), Collision Resolution')
set(get(AX(2),'Ylabel'),'String','Delay (RACH Cycles), No Collision Resolution')
set(get(TAX(2),'Ylabel'),'String','Delay (RACH Cycles), No Collision Resolution')
tl = title(sprintf('Average delay, %s', plottitle));
% Hack axis font sizes, etc
fixplot(AX(1), l, xl, get(AX(1), 'YLabel'), tl);
fixplot(AX(2), l, xl, get(AX(2), 'YLabel'), tl);
fixplot(TAX(1), l, xl, get(TAX(1), 'YLabel'), tl);
fixplot(TAX(2), l, xl, get(TAX(2), 'YLabel'), tl);
print('-depsc', sprintf('%s.eps', plotfile));
print('-dpng', sprintf('%s.png', plotfile));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment