淘豆网
下载此文档放大查看缩小查看   1/17
0/100
您的浏览器不支持进度条
更多>>该用户其他文档
下载所得到的文件列表
在notebook里使用matlab作图.docx
文档介绍:
1安装word安装matlab2.mond窗口输入notebook–setup然后按回车3.输入notebook即可启动word4,输入matlab命令如pi然后选中(单行可以不选中)后按下alt+D组合键,变绿色,如下所示5.再按下ctrl+Enter键,执行,出现蓝色结果或者图片。如下所示以下介绍几个matlab基本的操作命令,然后重点写了几个绘图命令(绿色为输入,蓝色为输出)pians=3.1416vpa(pi,100)ans=3.symsxf;f=@(x)100*(x(2)-x(1)^2)+(1-x(1))^2f=@(x)100*(x(2)-x(1)^2)+(1-x(1))^2x=[12],f(x)x=12ans=100y=[21];f(y)ans=-299x=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.5,0,2])myfun2=@(x)exp(2.*x)+sin(3.*x.^2)myfun2=@(x)exp(2.*x)+sin(3.*x.^2)plot(-1:0.01:2,myfun2(-1:0.01:2))fplot(myfun2,[-1,2]);fplot('tanh',[-2,2])sn=@(x)sin(1./x);fplot(sn,[0.01,0.1])fplot('[tanh(x),sin(x),cos(x)]',2*pi*[-11])x=logspace(-1,2);loglog(x,exp(x),'-s')gridont=0:pi/50:10*pi;plot3(sin(t),cos(t),t)rotate3dx=-3:0.1:3;y=1:0.1:5;[X,Y]=meshgrid(x,y);Z=(X+Y).^2;surf(X,Y,Z)shadingflatx=-3:0.1:3;y=1:0.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('示意图')gridonx=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,':')holdonplot(x,y)x=linspace(0,2*pi,100); 内容来自淘豆网www.taodocs.com转载请标明出处.