代码1:z = sqrt(x^2 + y^2)
close all x = -6:0.05:6; [X, Y]=meshgrid(x); Z = sqrt(X.^2 + Y.^2); mesh(X, Y, Z)
如图1:
代码2:z = 2 - x^2 - y^2
clear all x=-5:0.1:5; [X,Y]=meshgrid(x); Z=2-X.^2-Y.^2; mesh(X,Y,Z)
图2:
代码3:z = 1 - x^2
clear all x = -6:0.05:6; [X, Y]=meshgrid(x); Z = 1 - X.^2; mesh(X, Y, Z);
图3:
代码4:z = -1
clear all x=-5:0.1:5; [X,Y]=meshgrid(x); Z=zeros(size(X))-1; mesh(X,Y,Z)
图4
代码5:z = e^y*sinx - e^x*cosy + e^x + e^y
clear all syms x y f=sin(x)*exp(y)-cos(y)*exp(x)+exp(x)+exp(y); fmesh(f)
图5:
代码6:x = 2 * y^2
clear all x=-5:0.1:5; y=-5:0.1:5; z=[-5,5]; [X,Y,Z] = meshgrid(x,y,z); v = 2*Y.^2-X; isosurface(X,Y,Z,v,0) grid on
图6:
代码7:y = -1
clear all x=-5:0.1:5; y=-5:0.1:5; z=[-5,5]; [X,Y,Z] = meshgrid(x,y,z); v = Y + 1; isosurface(X,Y,Z,v,0)
图7:
代码8:x + 2y = 0
clear all x=-5:0.1:5; y=-5:0.1:5; z=[-5,5]; [X,Y,Z] = meshgrid(x,y,z); v = X+2*Y; isosurface(X,Y,Z,v,0); grid on
图8:
代码9:x = sin(t) y = cos(t) z = t
clear all xt = @(t) sin(t); yt = @(t) cos(t); zt = @(t) t; fplot3(xt,yt,zt)
图9:
代码10:x = e^(-t/10) * sin(5*t) y = e^(-t/10) * cos(5*t) z = t
clear all xt = @(t) exp(-t/10).*sin(5*t); yt = @(t) exp(-t/10).*cos(5*t); zt = @(t) t; fplot3(xt,yt,zt,[-10 10])
图10:
代码11:x^2 + y^2 + z^2 = 1
clear all x=-1:0.01:1; [X,Y]=meshgrid(x); Z=1-X.^2-Y.^2; Z(Z<0)=nan; Z1=sqrt(Z); Z2=-sqrt(Z); mesh(X,Y,Z1) hold on mesh(X,Y,Z2)
图11:
今天就学习到这里了。
标签:10,exp,--,clear,0.1,meshgrid,绘图,octave,代码 From: https://www.cnblogs.com/guochaoxxl/p/16856136.html