请选择 进入手机版 | 继续访问电脑版
爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5151|回复: 3

在写毕业论文,没有学过MATLAB,研究了一天了,还是看不太懂,求大神指教

[复制链接]

新浪微博达人勋

发表于 2018-3-21 16:04:48 | 显示全部楼层 |阅读模式
MATLAB
问题截图:
问题概况: 画不出亮温,而且不是很懂lat,lon,ori那里的语句为什么要乘上500,
我看过提问的智慧: 看过
自己思考时长(天): 1
系统平台:

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2018-3-21 17:09:05 | 显示全部楼层
设置一个断点,调一调看看问题出在哪
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 成长值: 32430
发表于 2018-3-21 19:09:58 | 显示全部楼层
本帖最后由 二爷名声在外 于 2018-3-21 19:21 编辑

楼主截图麻烦截的全一点

根据我的分析,楼主应该是读取卫星的亮温反演数据,然后分段进行画图。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2018-3-24 14:41:55 | 显示全部楼层
%画区域亮温值
clear
color = [
%     0     0        0
    0    0.0863    0.4824  
    0    0.2235    1.0000            
    0    0.6353    1.0000            
0    0.9843    1.0000                 
0    0.7294         0                 
0    0.8471         0                 
0.6157    0.9137         0            
1.0000    0.9804         0            
1.0000    0.7137         0            
0.9961    0.5137         0            
0.9961         0         0            
0.8431         0         0
% 0.9294    0.0275        0.8314
    ];  %设置12个基本颜色的RGB值

mincol=[0 0 0];
maxcol=[0.9294    0.0275        0.8314];
figure
latlim=[-30 30];lonlim=[-150 -100]; %设置所画区域的经纬度
position1=5;
position2=13;
xint=10; %纬度标注间隔
yint=10; %经度标注间隔
    ax=axesm('mercator','grid','off','MapLatLimit',latlim,'MapLonlimit',lonlim,'MLabelParallel','south', ... ,%将经度刻度标签放在南方,即下部
        'FlatLimit',latlim,'Frame','on','MeridianLabel','on','MLabelLocation',xint,'MLineLocation',xint, ... ,
        'ParallelLabel','on','PLabelLocation',yint,'PLineLocation',yint,'ScaleFactor',1,'LabelUnits','de',...
        'FontName','Times New Roman','FontSize',14,'FEdgecolor',[0 0 0],'PLabelRound',0,'FLineWidth',2); %坐标轴设置
    %  setm(gca,'MLabelLocation',60);%标上经度刻度标签,每隔60度。MLineLocation经度间隔
    %  setm(gca,'ParallelLabel','on');%设置经度刻度标签可见
   
%    setm(gca,'Origin',[0,180,0]) %设置地图的中心位置和绕中心点和地心点的轴旋转角度
   set(ax,'Visible','off');%---设置坐标轴可视  


data1=load('E:\MWTS\FY3C_MWTSX_GBAL_L1_20140701_0543_033KM_MS-TB—t.txt'); %输入亮温数据文件名

outpng=['E:\MWTS\ch8-20140701-PCA1-destripped.png'] %输出图形文件名
scanline=300;
nfov=90;
lat=data1(500*nfov+1:800*nfov,1);
lon=data1(500*nfov+1:800*nfov,2);
ori=data1(500*nfov+1:800*nfov,8); %指定某个通道亮温
% sim=data2(500*nfov+1:800*nfov,10);
lat=reshape(lat,nfov,scanline);
lon=reshape(lon,nfov,scanline);
ori=reshape(ori,nfov,scanline);%reshape函数重新调整矩阵的行列、数列、维数
% sim=reshape(sim,nfov,scanline);
caxis([1 13]); %  caxis([1,13])%将颜色的最小值对应的z取为1(小于1的无法分辩开),同样大于13的也没有办法分辨开
colormap(color)      

levels=[200.3:0.7:208.7];%数据范围0
value=ori; %画哪个变量
% % % 用点画法画
for i=1:12
        index=find(value>=levels(i) &value<=levels(i+1));
        hold on
       if length(index)<=0
        continue
       end
       h=plotm(lat(index),lon(index),'o');
        set(h,'MarkerSize',1); %  标记的尺寸
        set(h,'markerfacecolor',color(i,:),'markeredgecolor',color(i,:));
        %  MarkerFaceColor:标记点内部的填充颜色;MarkerEdgeColor:标记点边缘的颜色
        clear color;
        clear index;
end
hold on
% index=find(value>=208.7);
  %     if length(index)<=0
%        continue
  %      end
  %      h=plotm(lat(index),lon(index),'o');
  %       set(h,'MarkerSize',1);
  %       set(h,'markerfacecolor',maxcol,'markeredgecolor',color(12,:));
   %      clear c;
    %     clear idx;
         
  %  index=find(value<=200.3);
  %       hold on
  %     if length(index)<=0
  %       continue
  %      end
  %    h=plotm(lat(index),lon(index),'o');
  %    set(h,'MarkerSize',1);
  %      set(h,'markerfacecolor',mincol,'markeredgecolor',color(1,:));
  %       clear c;
  %       clear idx;      
  %  hold on;
%画色标
colorbar( 'location','eastoutside','xtick',[1,2,3,4,5,6,7,8,9,10,11,12],'yticklabel',...,
{'201.0','202.4','203.8','205.2','206.6','208.0'},...,
              'lineWidth',1,'FontName','times new roman','FontSize',12,...,
                 'TickLength',[0.02 0.025],'MinorGridLineStyle','-')  %字体大小12号
            
set(gcf,'color','white')
%画地图界限
SH_Shp2=shaperead('E:\GMI\world map china line\world map china line.shp');%(World map)
plotm(extractfield(SH_Shp2,'Y'),extractfield(SH_Shp2,'X'),'k');
%设置图片大小
set(gcf,'PaperUnits','centimeters')
   papersize = get(gcf, 'PaperSize');
   width =12;
   height= 16;
   left=(papersize(1)-width)/2;
   bottom=(papersize(2)-height);
   myfiguresize = [left, bottom, width, height];
   set(gcf, 'PaperPosition', myfiguresize);
   
%*************************新版边框复原 by Hong Chen************************


edgelongitude=getm(gca,'MapLonLimit');
edgelatitude=getm(gca,'MapLatLimit');

longitudestart=edgelongitude(1);longitudeend=edgelongitude(2);
latitudestart=edgelatitude(1);latitudeend=edgelatitude(2);

axis off; mlabel on; plabel on;
setm(gca,'MLabelParallel',latitudestart,'PLabelMeridian',longitudestart);
% 'MLabelParallel' latitude to label longtitudes
% 'PLabelMeridian' longtitude to label latitudes

latitude1(1)=latitudestart;longitude1(1)=longitudestart;
latitude2(1)=latitudestart;longitude2(1)=longitudeend;
latitude3(1)=latitudeend;longitude3(1)=longitudeend;
latitude4(1)=latitudeend;longitude4(1)=longitudestart;

longitudeinterval=(longitudeend-longitudestart)/10000.0;
latitudeinterval=(latitudeend-latitudestart)/10000.0;

for i=1:10000
    latitude1(i+1)=latitudestart;
    longitude1(i+1)=longitudestart+longitudeinterval*i;
    latitude2(i+1)=latitudestart+latitudeinterval*i;
    longitude2(i+1)=longitudeend;
    latitude3(i+1)=latitudeend;
    longitude3(i+1)=longitudeend-longitudeinterval*i;
    latitude4(i+1)=latitudeend-latitudeinterval*i;
    longitude4(i+1)=longitudestart;
end

borderlatitude=[latitude1,latitude2,latitude3,latitude4];
borderlongitude=[longitude1,longitude2,longitude3,longitude4];

plotm(borderlatitude,borderlongitude,'-k','LineWidth',1);
  set(gcf,'color','white')
  
%*************************************************************************

%------去除经纬度点 Da Cheng and Xu Chen-----2012/07/05----------
%plabel
h_plabel = handlem('plabel');
for i = 1:length(h_plabel)
    pstring = get(h_plabel(i),'string');
    pstring(4:12) = [];
    set(h_plabel(i),'string',pstring);
    set(h_plabel(i),'VerticalAlignment','baseline');
end

h_mlabel = handlem('mlabel');
for i = 1:length(h_mlabel)
    mstring = get(h_mlabel(i),'string');
    mstring(4:12) = [];  %  或者5:13,或者4:12
    set(h_mlabel(i),'string',mstring);
end
%-----------------------------------------------------------------

print(gcf, '-dtiff','-r600', outpng)
%  close(gcf);


是啊,在画观测的亮温,这个程序是画观测减亮温的,就是只能画出色标和坐标,中间那些乘500,800的地方也不是很明白,麻烦您帮我看一下吧,谢谢您
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表