下载此文档

在notebook里使用matlab作图.docx


文档分类:汽车/机械/制造 | 页数:约3页 举报非法文档有奖
1/3
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/3 下载此文档
文档列表 文档介绍
该【在notebook里使用matlab作图 】是由【lu2yuwb】上传分享,文档一共【3】页,该文档可以免费在线阅读,需要了解更多关于【在notebook里使用matlab作图 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。1安装word安装matlab
–setup然后按回车

4,输入matlab命令如pi然后选中(单行可以不选中)后按下alt+D组合键,变绿色,如下所示
+Enter键,执行,出现蓝色结果或者图片。如下所示
以下介绍几个matlab基本的操作命令,然后重点写了几个绘图命令(绿色为输入,蓝色为输出)
pi
ans=

vpa(pi,100)
ans=
symsxf;f=@(x)100*(x(2)-x(1)^2)+(1-x(1))^2
f=
@(x)100*(x(2)-x(1)^2)+(1-x(1))^2
x=[12],f(x)
x=
12
ans=
100
y=[21];f(y)
ans=
-299
x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);
plot(x,y,'r',x,z,'go')
ezplot('sin(x)',[0,5*pi])
ezplot('cos(t)^3','sin(t)^3',[0,2*pi])
ezplot('exp(x)+sin(x*y)',[-2,,0,2])
myfun2=@(x)exp(2.*x)+sin(3.*x.^2)
myfun2=
@(x)exp(2.*x)+sin(3.*x.^2)
plot(-1::2,myfun2(-1::2))
fplot(myfun2,[-1,2]);
fplot('tanh',[-2,2])
sn=@(x)sin(1./x);
fplot(sn,[,])
fplot('[tanh(x),sin(x),cos(x)]',2*pi*[-11])
x=logspace(-1,2);
loglog(x,exp(x),'-s')
gridon
t=0:pi/50:10*pi;
plot3(sin(t),cos(t),t)
rotate3d
x=-3::3;
y=1::5;
[X,Y]=meshgrid(x,y);
Z=(X+Y).^2;
surf(X,Y,Z)
shadingflat
x=-3::3;y=1::5;
[X,Y]=meshgrid(x,y);
Z=(X+Y).^2;
mesh(X,Y,Z)
[X,Y]=meshgrid(-3:.125:3);
Z=peaks(X,Y);
meshz(X,Y,Z)
x=linspace(0,2*pi,30);
y=sin(x);
plot(x,y)
xlabel('自变量X')
ylabel('函数Y')
title('示意图')
gridon
x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);
plot(x,y,x,z)
gtext('sin(x)');gtext('cos(x)')
x=linspace(0,2*pi,30);
y=sin(x);
z=cos(x);
plot(x,z,':')
holdon
plot(x,y)
x=linspace(0,2*pi,100);
y=sin(x);z=cos(x);
plot(x,y);
title('sin(x)')
figure(2);
plot(x,z);
title('cos(x)');
x=linspace(0,2*pi,100);
y=sin(x);z=cos(x);
a=sin(x).*cos(x);b=sin(x)./(cos(x)+eps);
subplot(2,2,1);plot(x,y),title('sin(x)')
subplot(2,2,2);plot(x,z),title('cos(x)')
subplot(2,2,3);plot(x,a),title('sin(x)cos(x)')
subplot(2,2,4);plot(x,b),title('sin(x)/cos(x)')
clear;clc;clf;x=linspace(0,2*pi,30);
y=sin(x);
plot(x,y)
zoomon
x=-3::3;y=1::5;
[X,Y]=meshgrid(x,y);
Z=(X+Y).^2;
subplot(2,2,1),mesh(X,Y,Z),
subplot(2,2,2),mesh(X,Y,Z),view(50,-34)
subplot(2,2,3),mesh(X,Y,Z),view(-60,70)
subplot(2,2,4),mesh(X,Y,Z),view([0,1,1])
closeall;[x,y,z]=peaks(30);
surf(x,y,z)
axis([-33-33-1010])
m=moviein(15);
fori=1:15
view(-+24*(i-1),30)
m(:,i)=getframe;
end
movie(m)
theta=linspace(0,2*pi);
rho=sin(2*theta).*cos(2*theta);
polar(theta,rho,'g');
title('Polarplotofsin(2*theta).*cos(2*theta)');
clf
loadseamount
scatter(x,y,5,z)
[X,Y]=meshgrid(-2:.2:2,-2:.2:3);
Z=X.*exp(-X.^2-Y.^2);
[C,h]=contour(X,Y,Z);
clabel(C,h,'manual')
colormapcool
请稍候...
仔细选择要用于标记的等高线。
完成后,当图形窗口为活动窗口时,请按Return键。
[x,y,z]=peaks;
subplot(1,2,1)
contour3(x,y,z,16,'s')
grid,xlabel('x-axis'),ylabel('y-axis')
zlabel('z-axis')
title('contour3ofpeaks');
subplot(1,2,2)
contour(x,y,z,16,'s')
grid,xlabel('x-axis'),ylabel('y-axis')
title('contourofpeaks');
[x,y,z]=sphere(16);
X=[x(:)*.5x(:)*.75x(:)];
Y=[y(:)*.5y(:)*.75y(:)];
Z=[z(:)*.5z(:)*.75z(:)];
S=repmat([]*10,prod(size(x)),1);
C=repmat([123],prod(size(x)),1);
scatter3(X(:),Y(:),Z(:),S(:),C(:),'filled'),view(-60,60)

在notebook里使用matlab作图 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数3
  • 收藏数0 收藏
  • 顶次数0
  • 上传人lu2yuwb
  • 文件大小15 KB
  • 时间2023-03-18