function plot_cost

nodes = [25 50 99 197];

J_EIR = [0.1562 0.1459 0.1437 0.1427];
Jeff_EIR = [0.0348  0.0334 0.0312 0.0304];
Jtr_EIR = [0.1213  0.1124 0.1126 0.1123];


J_TDS = [0.1490 0.1472 0.1434 0.1437];
Jeff_TDS = [0.0279 0.0306 0.0296 0.0298];
Jtr_TDS = [0.1211 0.1166 0.1139 0.1139];

hold on
plot(nodes, J_EIR, 'ok', 'LineWidth',0.5)
plot(nodes, J_TDS, '*k', 'LineWidth',0.5)
annotation(...
  'textbox',...
  'Position',[0.547 0.7401 0.3113 0.1557],...
  'String',{'cost function'},...
  'EdgeColor','none',...
  'FontSize',10,...
  'Interpreter','latex',...  
  'FitHeightToText','on');

annotation(...
  'textbox',...
  'Position',[0.547 0.5656 0.3245 0.1733],...
  'EdgeColor','none',...
  'FontSize',10,...
  'String',{'tracking term'},...
  'Interpreter','latex',...
  'FitHeightToText','on');

annotation(...
  'textbox',...
  'Position',[0.547 0.142 0.2717 0.1557],...
  'EdgeColor','none',...
  'FontSize',10,...
  'String',{'effort term'},...
  'Interpreter','latex',...
  'FitHeightToText','on');


plot(nodes, J_EIR, '-o', 'LineWidth',0.5, 'Color', [0 0 0])
plot(nodes, J_TDS, '-*', 'LineWidth',0.5, 'Color', [0 0 0])
plot(nodes, Jtr_EIR, '--o', 'LineWidth',0.5, 'Color', [0 0 0])
plot(nodes, Jtr_TDS, '--*', 'LineWidth',0.5, 'Color', [0 0 0])
plot(nodes, Jeff_EIR, '-.o', 'LineWidth',0.5, 'Color', [0 0 0])
plot(nodes, Jeff_TDS, '-.*', 'LineWidth',0.5, 'Color', [0 0 0])
h = gca;

hold off

legend('EDS','TDS');
%% Create legend
legend({'EDS','TDS'},...
  'Position',[0.5693 0.4258 0.1786 0.1381],...
  'EdgeColor',[1 1 1],...
  'Interpreter','latex');
%title('Cost Function vs. # of Nodes')
xlabel('nodes')
ylabel('cost function')

axis([0 200 0 0.16]);
box on
set(gca,'YGrid','on')

% set(0, ...
% 'defaulttextfontsize', 10, ...
% 'defaulttextfontname', 'cmr', ...
% 'defaultaxesfontsize', 10, ...
% 'defaultaxesfontsize', 10, ...
% 'defaultaxesfontname', 'cmr') 
