例如x取(1,2)间隔0.01,在MATLAB中表示为x=1:0.01:2。 示例如下
x = 1:0.01:2;
y = power(x,4);
plot(x,y)
结果如图:
y=power(x,4)
对于f(x,y),其中1 % [x,y] =meshgrid(1:0.01:2,2:0.01:4); x=1:0.01:2; y=2:0.01:4; [A,B]=meshgrid(x,y); z=sin(A).*cos(B) %注意这里是".*" surf(A,B,z); xlabel('X轴') ylabel('Y轴') zlabel('Z轴') z=sin(x).*cos(y) f(x,y),1 % [x,y] =meshgrid(1:0.01:2,2:0.01:4); x1=1:0.01:2; x2=3:0.01:4; y=2:0.01:4; [A,B]=meshgrid(x1,y); [C,B]=meshgrid(x2,y); z1=sin(A).*cos(B) z2=sin(C).*cos(B) surf(A,B,z1); xlabel('X轴') ylabel('Y轴') zlabel('Z轴') hold on; %hold on的应用 surf(C,B,z2); z=sin(x).*cos(y) 以上MATLAB的学习笔记