• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Airboy1
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

08 2018 档案

 
gcf,gca自己理解
摘要:a=[1,2,3,4]; % plot(a); ax=get(gcf,'children'); %set(gca,'XTick',[1,4]); ===set(ax,,'XTick',[1,4]) ax.XTick=[1,4]; ax.XTickLabel={'a','b'}; 阅读全文
posted @ 2018-08-27 19:26 Airboy1 阅读(571) 评论(0) 推荐(0)
创建图形对象
摘要:x=-4:0.5:4; y=x; [X,Y]=meshgrid(x,y); Z=X.^2-Y.^2; %% axes 创建坐标轴对象 并返回句柄ah ah=axes('color',[0.4 0.4 0.4],'xtick',[-4 -3 -2 -1 0 1 2 3 4],'XTickLabel',{'a','b','c','d','e','f','g','h'},'Xcolor','b' 阅读全文
posted @ 2018-08-27 15:00 Airboy1 阅读(177) 评论(0) 推荐(0)
三维图形 surfh 和 mesh
摘要:z=peaks(50); surfl(z) shading interp colormap copper 阅读全文
posted @ 2018-08-26 08:09 Airboy1 阅读(338) 评论(0) 推荐(0)
matlab 绘制圆锥螺旋线
摘要:v=20; t=[0:0.01*pi:50*pi]; alpha=pi/6; omega=pi/6; x=v*sin(alpha)*t.*cos(omega*t); y=v*sin(alpha)*t.*sin(omega*t); z=v*cos(alpha)*t; plot3(x,y,z,'r','linewidth',2) grid on 阅读全文
posted @ 2018-08-25 20:38 Airboy1 阅读(2717) 评论(0) 推荐(0)
绘制针状图
摘要:t=[0:0.5:25]; y=exp(-t/3)+sin(1+2*t); h=stem(t,y,'--'); set(get(h,'baseline'),'linestyle',':'); %把水平轴设置成: 的形状 set(h,'markerfacecolor','yellow'); hold on t2=[0:0.1:25]; y2=exp(-t2/3)+sin(1+2*t2); p... 阅读全文
posted @ 2018-08-25 20:16 Airboy1 阅读(578) 评论(0) 推荐(0)
绘制矢量图
摘要:n=-2:0.2:2; [x,y,z]=peaks(n); %绘制peaks 三维曲线,并用 x y z 存储 [u,v]=gradient(z); %求各各点的在水平方向和竖直方向的梯度 quiver(x,y,u,v); %绘制矢量图 hold on contour(x,y,z,10) % 设置等高线的根数(画出来有n根等高线) 阅读全文
posted @ 2018-08-25 19:49 Airboy1 阅读(495) 评论(0) 推荐(0)
饼图pie 或者pie3
摘要:%% pie(x,explode),explode 是一个与x同纬的矩阵,非0 时 使对应的部分突出 x=[1 2.5 1.8 3.6 2.4]; subplot(221);pie(x,1:5,{'Dep1','Dep2','Dep3','Dep4','Dep5'}); subplot(222);pie(x); subplot('Position',[0.2,0.05,0.6,0.45]); ... 阅读全文
posted @ 2018-08-25 19:30 Airboy1 阅读(356) 评论(0) 推荐(0)
三维直方图
摘要:Y=cool(8); subplot(221);bar3(Y,'detached');title('Detached'); subplot(222);bar3(Y,'grouped');title('Grouped'); subplot(223);bar3(Y,'stacked');title('Stacked'); subplot(224);bar3(Y,0.3,'stacked');titl... 阅读全文
posted @ 2018-08-25 19:19 Airboy1 阅读(317) 评论(0) 推荐(0)
直方图
摘要:%% bar bar3 竖直 bar( ,'style') group 默认,stack 堆叠 Income=[0.5,0.7,0.8;0.7,0.8,0.4;0.4,0.3,0.9;0.3,0.6,0.9;0.2,0.1,0.6]; subplot(221) bar(Income,'group');title('group') subplot(222) bar(Income,'stac... 阅读全文
posted @ 2018-08-25 16:55 Airboy1 阅读(231) 评论(0) 推荐(0)
面积图
摘要:y=[2 ,4,5; 3,1,9; 5,3,5; 2,6,1] area(y) %第一列绘图;第一列加第二列绘图;第一列加第二列加第三列绘图; grid on colormap summer % 设置当前图层的颜色 set(gca,'layer','top') %将面积图的图层设置为最顶层 阅读全文
posted @ 2018-08-25 14:40 Airboy1 阅读(299) 评论(0) 推荐(0)
ezplot (fplot见matlab 宝典)
摘要:%% ezplot 无需指定自变量的范围 syms t % 将 t 设置为符号变量 y=3/4*(exp(-2*t/3)*sin(1+2*t)); ezplot(y,[pi,3*pi]); 阅读全文
posted @ 2018-08-25 09:33 Airboy1 阅读(845) 评论(0) 推荐(0)
绘制动态
摘要:axis([0 10 0 10]); hold on xy=[]; n=0; disp('Left mouse button picks points') disp('Right mouse button picks last point') but=1; while but==1 [xi,yi,but]=ginput(1); plot(xi,yi,'ro') n=n+... 阅读全文
posted @ 2018-08-25 09:15 Airboy1 阅读(193) 评论(0) 推荐(0)
subplot 设置不一样的图片大小和位置
摘要:t=[0:0.1:25]; y1=exp(-t/3); y3=sin(2*t+3); y2=log(t+1); subplot(2,2,1) plot(t,y1,'linewidth',2) subplot(2,2,2) plot(t,y2,'linewidth',2) % subplot(2,2,[3,4]) % 可以这样设置 一张图占多张图的位置 subplot('position',... 阅读全文
posted @ 2018-08-25 08:29 Airboy1 阅读(4648) 评论(0) 推荐(0)
绘制双坐标轴的图形
摘要:%[AX,H1,H2]=plotyy(...):返回AX中创建的两个坐标轴的句柄以及H1和H2中每个图形绘图对象的句柄。AX(1)为左侧轴,AX(2)为右侧轴。 x = 0:0.01:20; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); figure % new figure [hAx,hLine1,hLine... 阅读全文
posted @ 2018-08-25 08:14 Airboy1 阅读(408) 评论(0) 推荐(0)
绘制双坐标轴的图形3-不同的plot类型
摘要:Income=[2456,2032,1900,2450,2890,2280]; Profit_margin=[12.5,11.3,10.2,14.5,14.3,15.1]/100; t=1:6; [AX,H1,H2]=plotyy(t,Income,t,Profit_margin,'bar','plot'); % set(get(AX(1),'Ylabel'),'String','Left-ax... 阅读全文
posted @ 2018-08-24 22:01 Airboy1 阅读(382) 评论(0) 推荐(0)
绘制双坐标轴的图形2-不同的plot类型
摘要:x = 0:0.1:10; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); figure [hAx,hLine1,hLine2]=plotyy(x,y1,x,y2,'plot','stem');#以不同形式绘图 ylabel(hAx(1),'Slow Decay') % left y-axis 修改左边y轴的... 阅读全文
posted @ 2018-08-24 21:42 Airboy1 阅读(337) 评论(0) 推荐(0)
hold on
摘要:一次hold on之后,未见hold off前,所有的图都将叠加在 原图中 阅读全文
posted @ 2018-08-24 20:32 Airboy1 阅读(193) 评论(0) 推荐(0)
设置X轴,y轴分格线,使用对象句柄完成
摘要:gca 用来返回当前axes (坐标图)对象的句柄 在command 里面输入gca Axes (Y-logX) (具有属性): XLim: [0.0100 1] YLim: [0 100] XScale: 'log' YScale: 'linear' GridLineStyle: '-' Posi 阅读全文
posted @ 2018-08-24 20:06 Airboy1 阅读(294) 评论(0) 推荐(0)
取消坐标轴上边和右边边框
摘要:plot() box off 阅读全文
posted @ 2018-08-24 19:37 Airboy1 阅读(731) 评论(0) 推荐(0)
绘制包络线
摘要:x=0.:pi/8:4*pi; y=exp(-x/3).*sin(3*x); yb=exp(-x/3); plot(x,yb,'k-',x,-yb,'k-',x,y,'-ro','linewidth',2,'markeredgecolor','g','markerfacecolor','y','markersize',6) grid on 阅读全文
posted @ 2018-08-24 19:28 Airboy1 阅读(1092) 评论(0) 推荐(0)
连续函数的可视化
摘要:### plot默认是实线连接,离散的数据使用默认plot时,会连起来x1=0:16; y1=1./((x1-2).^2+1)+1./((x1-9^.2+4))+5; x2=0:0.02:16; y2=1./((x2-2).^2+1)+1./((x2-9^.2+4))+5; subplot(2,2,1),plot(x1,y1,'rp'),axis([0 17 5 6.2]),title('Pi... 阅读全文
posted @ 2018-08-24 17:07 Airboy1 阅读(198) 评论(0) 推荐(0)
离散数据可视化
摘要:n=0:16; y=1./((n-2).^2+1)+1./((n-9^.2+4))+5; #.运算 进行矩阵运算 plot(n,y,'mh','markersize',15) # m是品红色,h是 六角形,15是 六角形的大小 axis([0 17 5 6.2]) # 设置坐标轴的范围 grid on 阅读全文
posted @ 2018-08-24 16:45 Airboy1 阅读(292) 评论(0) 推荐(0)
matlab 以cell的形式读取excel---保留原excel 里面的字符
摘要:[Data,DataText,DataCell]=xlsread('new.xls','Sheet1') DataCell是全部的cell cell 格式 Data带有NAN(代表字符)的全部元素 double 格式 DataText 只包含字符 [~,~,DataCell]=xlsread('ne 阅读全文
posted @ 2018-08-18 09:57 Airboy1 阅读(2887) 评论(0) 推荐(0)
 

公告


博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3