资源描述:
《matlab应用经典案例.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Peaks随机动画axisoff;set(gcf,'menubar','none','toolbar','none');fork=1:100h=text(rand,rand,...['fontsize{',num2str(unifrnd(20,50)),'}fontname{隶书}纪刚'],...'color',rand(1,3),'Rotation',360*rand);pause(0.1);endtyte3sin3衰减震荡曲线t=0:pi/50:4*pi;yo=exp(-t/3);y=exp(-t/3).*sin(3*t);pl
2、ot(t,y,'-r',t,y0,':b',t,-y0,':b'),grid22sin(xy)z三维立体曲线22xyclearx=-8:0.5:8;y=x';X=ones(size(y))*x;Y=y*ones(size(x));R=sqrt(X.^2+Y.^2)+eps;Z=sin(R)./R;mesh(Z);colormap(hot)y=tan(sin(t))-sin(tan(t));comet(t,y)彗星曲线图t=0:2*pi/90:2*pi;y=cos(4*t);polar(t,y)极坐标x=[1,3,5,7,9,8,6,6
3、];y=[00010000];>>pie(x,y)绘制扇形统计图a=rand(33,1);b=rand(33,1);c=rand(16,1);scatter(a,b,69,'p')产生随机点t=0:pi/50:10*pi;plot3(t,sin(t),cos(t),'r:')三维曲线图pie3([1234])三维饼图[x,y,z]=peaks(88);surfc(x,y,z)三维等高线t1=0:0.1:0.9;t2=1:0.1:2;r=[t1-t2+2];[x,y,z]=cylinder(r,30);surf(x,y,z)三维柱面绘图函数[
4、x,y,z]=sphere(30);surf(x,y,z);三维球面Matlab绘图颜色peaks,shadingfaceted三维立体网格修饰peaks,shadingflat三维立体去黑线条改颜色contour(peaks,10);C=contourc(peaks,10);clabel(C)等高线f=@(x,y)(y-(5.1/(4*pi^2))*x.^2+5/pi*x-6).^2+10*(1-1/(8*pi))*cos(x)+10;[X,Y]=meshgrid(-5:0.5:10,0:0.5:15);fXY=f(X,Y);surf(X
5、,Y,fXY)xlabel('x');ylabel('y');str=strcat('${left(-frac{51,x^2}{40,{pi}^@}+frac{5,x}{pi}',...'+y-6right)}^@-cos!left(xright),left(frac{5}{4,pi}',...'-10right)+10$');title(str,'interpreter','latex','fontsize',15)2251x5x1fxy,y6101cos()10,5x
6、x10,0y154028灰色预测模型代码n=length(x);x1=cumsum(x);z1=(x1(1:n-1)+x1(2:n))/2;Y=x(2:length(x))';B=[-z1',ones(n-1,1)];A=(B'*B)B'*Y;beta=A(2)/(1+.5*A(1));alpha=A(1)/(1+.5*A(1));f=@(t)(beta-(alpha)*exp(-(A(1)*(t-2))));pre=f(999)Z=magic(20).*randn(20);compass(Z)th=(-90:1
7、0:90)*pi/180;>>r=4*ones(size(th));>>[u,v]=pol2cart(th,r);>>feather(u,v);>>th=(-90:10:90)*pi/180;>>r=4*ones(size(th));>>[u,v]=pol2cart(th,r);>>feather(u,v);>>th=(-90:10:90)*pi/180;r=4*ones(size(th));[u,v]=pol2cart(th,r);feather(u,v);速度向量图[X,Y,Z]=peaks(20);stem3(X,Y,Z,'r*')三
8、维离散数据图x=[0:0.15:2*pi];y=[0:0.15:2*pi];z=sin(y')*cos(x);surf(x,y,z);xlabel('x-axis'),ylabe