% Dette er filen mle.m
function [lnl] = mleOB(source,callbackdata)
  global n;
  global x;
  global sigma;
  global lnlgrense;
  my=get(source,'Value');
  subplot(1,10,1:9);
  plot(160:.1:200,normpdf(160:.1:200,my,sigma),'color',[1 0 0]);
  xlim([160 200]);
  set(gca,'Position',[.1 .13 .6956 .8150],'Units','normalized');
  hold on;
  scatter(x,repmat(0,1,n),'filled','MarkerFaceColor',[.5 .5 1],'MarkerEdgeColor',[0 0 1]);
  tekst2=('m');
  title(['\mu = ' num2str(my)]);
  hold off;
  lnl=0;
  for i=1:n
    line([x(i) x(i)],[0 normpdf(x(i),my,sigma)])
  end;
  lnl=-.5*sum(((x-my)/sigma).^2)-n*(.5*log(2*pi*sigma^2));
  subplot(1,10,10);
  bar(1,lnl,1);
  ylim([lnlgrense 0])
  set(gca,'XTickLabel','','XTick',0,'Position',[0.9 0.13 0.03 0.8150],'Units','normalized');
  handle=title(['ln \it L = ' num2str(lnl)]);
  set(handle,'Position',[0 .5629 0]);
  hold off;
end
