当前位置:编程学习 > Matlab >>

Matlab基本函数-compass函数

1、compass函数:罗盘图
 
2、用法说明:
 
(1)compass(x,y)函数绘制一个由原点出发由(x,y)组成的向量箭头图形;
 
(2)compass(z)等价于compass(real(z),imag(z));
 
(3)compass(...,LineSpec)函数用参量LineSpec指定箭头的线型、标记符号、颜色等属性;
 
(4)h = compass(...)函数返回line对象的句柄给h。
 
3、实例
 
 3.1、compass(x,y)
 
  (1)源码
 
 
[plain]  
>> x=1:100  
  
x =  
  
  Columns 1 through 17  
  
     1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16    17  
  
  Columns 18 through 34  
  
    18    19    20    21    22    23    24    25    26    27    28    29    30    31    32    33    34  
  
  Columns 35 through 51  
  
    35    36    37    38    39    40    41    42    43    44    45    46    47    48    49    50    51  
  
  Columns 52 through 68  
  
    52    53    54    55    56    57    58    59    60    61    62    63    64    65    66    67    68  
  
  Columns 69 through 85  
  
    69    70    71    72    73    74    75    76    77    78    79    80    81    82    83    84    85  
  
  Columns 86 through 100  
  
    86    87    88    89    90    91    92    93    94    95    96    97    98    99   100  
  
>> y=rand(1,100)  
  
y =  
  
  Columns 1 through 10  
  
    0.8147    0.9058    0.1270    0.9134    0.6324    0.0975    0.2785    0.5469    0.9575    0.9649  
  
  Columns 11 through 20  
  
    0.1576    0.9706    0.9572    0.4854    0.8003    0.1419    0.4218    0.9157    0.7922    0.9595  
  
  Columns 21 through 30  
  
    0.6557    0.0357    0.8491    0.9340    0.6787    0.7577    0.7431    0.3922    0.6555    0.1712  
  
  Columns 31 through 40  
  
    0.7060    0.0318    0.2769    0.0462    0.0971    0.8235    0.6948    0.3171    0.9502    0.0344  
  
  Columns 41 through 50  
  
    0.4387    0.3816    0.7655    0.7952    0.1869    0.4898    0.4456    0.6463    0.7094    0.7547  
  
  Columns 51 through 60  
  
    0.2760    0.6797    0.6551    0.1626    0.1190    0.4984    0.9597    0.3404    0.5853    0.2238  
  
  Columns 61 through 70  
  
    0.7513    0.2551    0.5060    0.6991    0.8909    0.9593    0.5472    0.1386    0.1493    0.2575  
  
  Columns 71 through 80  
  
    0.8407    0.2543    0.8143    0.2435    0.9293    0.3500    0.1966    0.2511    0.6160    0.4733  
  
  Columns 81 through 90  
  
    0.3517    0.8308    0.5853    0.5497    0.9172    0.2858    0.7572    0.7537    0.3804    0.5678  
  
  Columns 91 through 100  
  
    0.0759    0.0540    0.5308    0.7792    0.9340    0.1299    0.5688    0.4694    0.0119    0.3371  
  
>> compass(x,y)  
 (2)运行结果


补充:综合编程 , 其他综合 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,