您的位置:首页 > 编程语言 > MATLAB

如何在MatLab中画带箭头的坐…

2016-05-23 10:34 411 查看
原文地址:如何在MatLab中画带箭头的坐标系作者:Owenseng如何在MatLab中画带箭头的坐标系
%%画线然后填充

clear;

close all;
%%

u = 1;

v = 2;

x=-3:3;

y=u * x + v;

figure; plot(x,y,'LineWidth',1.5);

hold on;
%Draw axes

plot([0 0],[min(y)-1 max(y)+1],'k',[min(x)-1 max(x)+1],[0
0],'k');
% Draw arrows

ax=[max(x)+1,max(x)+1-0.3,max(x)+1-0.3; 0,0.12,-0.12];

fill(ax(1,:),ax(2,:),'k');

ay=[0,0.08,-0.08; max(y)+1,max(y)+1-0.4,max(y)+1-0.4];

fill(ay(1,:),ay(2,:),'k');
%%

text(0.2, 5.6, 'y', 'FontName','Times New
Roman','FontAngle','Italic','FontSize',18,
'HorizontalAlignment','left')

text(3.6, -0.1, 'x','FontName','Times New
Roman','FontAngle','Italic','FontSize',18,
'VerticalAlignment','top')

axis off

print('-djpeg', 'Oxy.jpg')

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lionxiao/archive/2009/08/16/4453532.aspx

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
annotation('doublearrow',[0.2 0.3],[0.5 0.6])
可以画坐标在0-1之间的箭头

要画任意的箭头,在
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=8396&objectType=FILE#
点击里面的Download Now:zip下载文件把解压后的arrow.m放入matlab当前路径,直接调用arrow函数即可

来源:http://zhidao.baidu.com/question/71952214.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: