load carsmall;
phat = mle(MPG);
numbins = 20;
figure
histogram(MPG,numbins,'Normalization','pdf')
hold on
box off
xi = -3:.1:60;
y = normpdf(xi,phat(1),phat(2));
plot(xi,y,'LineWidth',2)
xlim([-3 60])
xlabel('$x$', 'FontSize',14, 'Interpreter','latex')
ylabel('$p(x)$', 'FontSize',14, 'Interpreter','latex')
【MATLAB例】Maximum likelihood estimates
于 2024-06-21 19:22:16 首次发布