DUKE
2009-03-05, 15:51
我运行时下面的程序时,总是出现程序后面的错误提示:
% close all open figure window
close all
% create the mesh
[x,y]=meshgrid(linspace(-4,4,50));
% calculate z-values
z=3*x./(x.^2+y.^2+1);
% draw and label the contours
[c,h]=contour(x,y,z,10);
clabel(c,h,'manual')
% hold the plot
hold on
% labels and title
xlabel('x-axis')
ylabel('y-axis')
title('Level curves and gradient field of f(x,y) = 3x/(x^2 + y^2 + 1).')
% create the mesh locations for the gradient vectors
[x,y]=meshgrid(-4:.5:4);
% compute the gradient of F
Fx=(3*y.^2-3*x.^2+3)./(x.^2+y.^2+1).^2;
Fy=-6*x.*y./(x.^2+y.^2+1).^2;
% sketch the gradient field
quiver(x,y,Fx,Fy)
% turn on the grid
grid on
axis equal
??? Attempt to execute SCRIPT figure as a function.
Error in ==> gcf at 33
h = figure;
Error in ==> newplot at 61
fig = gcf;
Error in ==> contour at 64
cax = newplot(cax);
就是上面的三行错误提示,请各位高手帮帮忙啊:lovely: 谢谢了
% close all open figure window
close all
% create the mesh
[x,y]=meshgrid(linspace(-4,4,50));
% calculate z-values
z=3*x./(x.^2+y.^2+1);
% draw and label the contours
[c,h]=contour(x,y,z,10);
clabel(c,h,'manual')
% hold the plot
hold on
% labels and title
xlabel('x-axis')
ylabel('y-axis')
title('Level curves and gradient field of f(x,y) = 3x/(x^2 + y^2 + 1).')
% create the mesh locations for the gradient vectors
[x,y]=meshgrid(-4:.5:4);
% compute the gradient of F
Fx=(3*y.^2-3*x.^2+3)./(x.^2+y.^2+1).^2;
Fy=-6*x.*y./(x.^2+y.^2+1).^2;
% sketch the gradient field
quiver(x,y,Fx,Fy)
% turn on the grid
grid on
axis equal
??? Attempt to execute SCRIPT figure as a function.
Error in ==> gcf at 33
h = figure;
Error in ==> newplot at 61
fig = gcf;
Error in ==> contour at 64
cax = newplot(cax);
就是上面的三行错误提示,请各位高手帮帮忙啊:lovely: 谢谢了