Esta página aún no se ha traducido para esta versión. Puede ver la versión más reciente de esta página en inglés.


Interactive contour plot




fsurfht(fun,xlims,ylims) is an interactive contour plot of the function specified by the text variable fun. The x-axis limits are specified by xlims in the form [xmin xmax], and the y-axis limits are specified by ylims in the form [ymin ymax].

fsurfht(fun,xlims,ylims,p1,p2,p3,p4,p5) allows for five optional parameters that you can supply to the function fun.

The intersection of the vertical and horizontal reference lines on the plot defines the current x value and y value. You can drag these reference lines and watch the calculated z-values (at the top of the plot) update simultaneously. Alternatively, you can type the x value and y value into editable text fields on the x-axis and y-axis.


Plot the Gaussian likelihood function for the gas.mat data.

load gas

Create a function containing the following commands, and name it gauslike.m.

function z = gauslike(mu,sigma,p1)
n = length(p1);
z = ones(size(mu));
for i = 1:n
z = z .* (normpdf(p1(i),mu,sigma));

The gauslike function calls normpdf, treating the data sample as fixed and the parameters µ and σ as variables. Assume that the gas prices are normally distributed, and plot the likelihood surface of the sample.

fsurfht('gauslike',[112 118],[3 5],price1)

The sample mean is the x value at the maximum, but the sample standard deviation is not the y value at the maximum.

mumax = mean(price1)
mumax =
sigmamax = std(price1)*sqrt(19/20)
sigmamax =

Introducido antes de R2006a