部分MATLAB源程序与效果图
一、正态分布双曲线[attach]170[/attach]
clear
x=0:pi/10:2*pi;
y1=sin(x);
y2=cos(x);
plot(x,y1,x,y2)
grid on
xlabel('independent variable X')
ylabel('Dependent Variable Y1 & Y2')
title('Sine and Cosine Curve')
text(1.5,0.3,'cos(x)')
gtext('sin(x)');
axis([0 2*pi -0.9 0.9])
二、螺旋曲线
[attach]171[/attach]
x=0:pi/10:2*pi;
y1=sin(x);
y2=cos(x);
plot3(y1,y2,x,'m:p')
grid on
xlabel('Dependent Variable Y1')
ylabel('Dependent Variable Y2')
zlabel('Independent Variable X')
title('Sine and Cosine Curve')
三、平方和曲线
[attach]172[/attach]
clear
x=-4:0.2:4;
y=-4:0.2:4;
[X,Y]=meshgrid(x,y);
R=sqrt(X.^2/4+Y.^2/9)+eps
Z=real(R);
subplot(2,2,1);
surf(X,Y,Z)
hold on
surf(X,Y,-Z)
title('z^2=X.^2/4+Y.^2/9')
xlabel('X轴')
ylabel('Y轴')
zlabel('Z轴')
subplot(2,2,2);
surf(X,Y,Z)
hold on
surf(X,Y,-Z)
view(90,0)
xlabel('X轴')
ylabel('Y轴')
zlabel('Z轴')
subplot(2,2,3);
surf(X,Y,Z)
hold on
surf(X,Y,-Z)
view(90,45)
xlabel('X轴')
ylabel('Y轴')
zlabel('Z轴')
subplot(2,2,4);
surf(X,Y,Z)
hold on
surf(X,Y,-Z)
view(-37.5,180)
xlabel('X轴')
ylabel('Y轴')
zlabel('Z轴')
subplot(2,2,1)
title('z^2=X.^2+Y.^2')
title('z^2=X^2+Y^2')
四、椭圆曲面
[attach]173[/attach]
clear
x=-2:0.1:2;
y=-3:0.1:3;
[X,Y]=meshgrid(x,y)
R=4*sqrt(1-X.^2/4-Y.^2/9)
Z=real(R);
subplot(2,2,1)
surf(X,Y,Z)
hold on
surf(X,Y,-Z)
title('X^2/4+Y^2/9+Z^2/16=1')
xlabel(' X轴')
ylabel(' Y轴')
zlabel(' Z轴')
subplot(2,2,2)
surf(X,Y,Z)
hold on
surf(X,Y,-Z)
view(-45,0)
title('view(-45,0)')
xlabel(' X轴')
ylabel(' Y轴')
zlabel(' Z轴')
subplot(2,2,3)
surf(X,Y,-Z)
hold on
surf(X,Y,Z)
view(90,90)
title('view(90,90)')
xlabel(' X轴')
ylabel(' Y轴')
zlabel(' Z轴')
subplot(2,2,4)
surf(X,Y,Z)
hold on
surf(X,Y,-Z)
view(120,67.5)
title('view(120,67.5)')
xlabel(' X轴')
ylabel(' Y轴')
zlabel(' Z轴') /:A073?
好东西啊
页:
[1]