Matlab中小语法点总结(更新中) - limanjihe
1. A(:,1)\’ A(:)\’ A(:).\’
A(:,n)\’ 对矩阵A的低n列进行共轭转置;A(:).\’对矩阵A进行转置;
2.subplot的使用方法:
h =subplot(m,n,p)
将数字窗口分成m×n的网格,
并在当前图的第p个位置创建一个轴对象,并返回轴句柄。
坐标轴沿着图形窗口的第一行,然后是第二行等。
例如: subplot(2,2,1)
表示一个2行2列的画布上,你用第一行第一列画图。
% figure t=0:0.001:1; y1=sin(10*t); y2=sin(15*t); y3=sin(20*t); y4=sin(25*t); subplot(2,2,[1:2]) plot(t,y1,\'--r*\',\'linewidth\',2,\'markersize\',5) text(.5,.5,{\'subplot(2,2,1)\'},... \'FontSize\',14,\'HorizontalAlignment\',\'center\') subplot(2,2,2) plot(t,y2,\'--b*\',\'linewidth\',2,\'markersize\',5) text(.5,.5,{\'subplot(2,2,2)\'},... \'FontSize\',14,\'HorizontalAlignment\',\'center\') subplot(2,2,3) plot(t,y2,\'--b*\',\'linewidth\',2,\'markersize\',5) text(.5,.5,{\'subplot(2,2,3)\'},... \'FontSize\',14,\'HorizontalAlignment\',\'center\') subplot(2,2,4) plot(t,y2,\'--r*\',\'linewidth\',2,\'markersize\',5) text(.5,.5,{\'subplot(2,2,4)\'},... \'FontSize\',14,\'HorizontalAlignment\',\'center\')
不对称子图
subplot(2,2,[1:2]) plot(t,y1,\'--r*\',\'linewidth\',2,\'markersize\',5) text(.5,.5,{\'subplot(2,2,1)\'},... \'FontSize\',14,\'HorizontalAlignment\',\'center\')
text(x,y,z,\’string\’.\’PropertyName\’,PropertyValue…) :对引号中的文字string定位于用坐标轴指定的位置,且对指定的属性进行设置。
3.使用worldmap画地图
worldmap(\'CHINA\') % World load coastlines plotm(coastlat,coastlon)