=================================matlab保存指定分辨率图片
set(gcf, ‘PaperPositionMode‘, ‘auto‘)
print -djpeg -r500 1
==================================matlab保存矩阵成txt格式
dlmwrite(‘X.txt‘, X, ‘precision‘, ‘%5f‘, ‘delimiter‘, ‘\t‘)
来自http://www.ilovematlab.cn/thread-107494-1-1.html
=======================================matlab保存数据
fid = fopen(‘zzt_residual1.dat‘,‘wt+‘);
for i=1:m
fprintf(fid,‘%20s %4.4f \r\n‘,y(i,:),b(i,:));
end
fclose(fid);
matlab 标注事件
==============================matlab 多个子图同一个colorbar
figure
n=5;t=0.75/n; %如果5个子图,则每个子图的高度t设0.15,可再调整设置
% n=3;t=0.25; %如果3个子图,则每个子图的高度t设0.25
for i=1:n
h(i)=subplot(n,1,i);
set(h(i),‘Position‘,[0.15 1-(t+0.04)*i 0.7 t])
[S,F,T]= myspectrogram(datafre(:,i));
caxis([0 150])
end
h=colorbar;
% get(h, ‘Position‘)
set(h,‘Position‘,[0.88 0.15 0.02 0.8])
caxis([0 150])
set(get(h,‘Title‘),‘string‘,‘ugal‘);
==================================matlab经纬度计算距离
distance(24.43,117.62,y(1),x(1),almanac(‘earth‘,‘ellipsoid‘))
或者
distance(24.43,117.62,y(1),x(1))
算出来的单位仍是度,换算成距离的话,需要再乘以Pi/180再乘以6371,单位为千米
distance(23.0,101.1,2.06,113.34,6378.1),6378.1是地球半径,直接算的就是距离 |
=====================================matlab画省界图
load(‘shengjielat.mat‘)
load(‘shengjielon.mat‘)
% hold on;
plot(shengjielat,shengjielon)
ylim([0 60])
axis([105 125 20 30])