<<--B站..........欢迎来到DGX的博客..........GitHub-->>

我的B站

MATLAB第二次作业

题目

 

 (1)

x=0:24;
y=[15 14 14 14 14 15 16 18 20 22 23 25 28 31 32  31 29 27 25 24 22 20 18 17 16];
plot(x,y);

  

(2)方法一(matlab和电脑端打开内容形状都一样)

x=[0:24];
y=[15 14 14 14 14 15 16 18 20 22 23 25 28 31 32  31 29 27 25 24 22 20 18 17 16];
z=[x;y];
dlmwrite('气温.txt',z,'newline','pc');

  方法二(matlab打开没问题,电脑端打开的空格符是“口”形状)

x=[0:24];
y=[15 14 14 14 14 15 16 18 20 22 23 25 28 31 32  31 29 27 25 24 22 20 18 17 16];
z=[x;y];
dlmwrite('气温.txt',z,'delimiter','\b');

  

 

 

 (1)

%plot
x=-2:0.01:2;
y=x.^2.*sin(x.^2-x-2);
plot(x,y);
%fplot
fplot(@(x)x.^2.*sin(x.^2-x-2),[-2,2]);

  

(2)

t=linspace(0,2*pi,1000);
x=2*sin(t);
y=3*cos(t);
plot(x,y);grid on;

  

(3)

x=linspace(-3+eps,3-eps,1000);
y=linspace(-3+eps,3-eps,1000);
[X,Y]=meshgrid(x,y);
z=X.^2+Y.^2;
mesh(X,Y,z);grid on;

  

(5)

t=linspace(0+eps,2*pi-eps,1000);
x=sin(t);
y=cos(t);
z=cos(2*t);
plot3(x,y,z);grid on;

  

(6)

x=linspace(0+eps,pi-eps,1000);
y1=sin(x);
y2=sin(x).*sin(10*x);
y3=-sin(x);
plot3(y1,y2,y3);grid on;

  

 

posted @ 2020-09-25 19:06  DG息  阅读(178)  评论(0)    收藏  举报