版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Good is good, but better carries it.精益求精,善益求善。MATLAB例程MatlabResources:/pages/jf262/matlab_main.htm1.MatlabatMathWorksFulldocumentationbythedeveloperHYPERLINK/access/helpdesk/help/techdoc/matlab.htmlt_blank/access/helpdesk/help/techdoc/matlab.html2.MatLabTutorialHYPERLINK/%7Ebonnie/book/TUTORIAL/tuto
2、rial.htmlt_blank/%7Ebonnie/book/TUTORIAL/tutorial.htmlThistutorialisavailableasasupplementtothetextbookFundamentalsofSignalsandSystemsUsingMatlabbyEdwardKamenandBonnieHeck,publishedbyPrenticeHall.Alsoavailableaspdf.HYPERLINK/pages/jf262/matlab/useful%20pages/tutorial.pdft_blank/pages/jf262/matlab/us
3、eful%20pages/tutorial.pdf3.MatLabgraphicsHYPERLINK/pages/jf262/matlab/useful%20pages/Matlab%20graphics.htmt_blank/pages/jf262/matlab/useful%20pages/Matlab%20graphics.htmTomiSalminen,CSC1998.AnintroductiontoMatlabgraphicscommandswithexamplesandfigures.4.NumericalComputingwithMATLABHYPERLINK/pages/jf2
4、62/matlab/ebook1/ncm_index.htmt_blank/pages/jf262/matlab/ebook1/ncm_index.htm5.MatLabvectorandmatrixtips(pdf)HYPERLINK/pages/jf262/matlab/useful%20pages/mtt.pdft_blank/pages/jf262/matlab/useful%20pages/mtt.pdf6.MatlabPrograming:Design&Application(Chinese)/pages/jf262/matlab/matlablearn/index.htmfigu
5、re1)h=bar(clrflux_up10(:,2),clrflux_up10(:,3),Edgecolor,k,Facecolor,k)holdonbar(pollutionflux_up10(:,2),pollutionflux_up10(:,3),Edgecolor,k,Facecolor,w)axis(400700015);boxoffxlabel(TOAflux(Wm-2)legend(AODleq0.2,AOD0.5)axis(400700015);set(gca,TickLength,0.015;0.015)set(gca,TickDir,out);set(gca,positi
6、on,0.4)plot(DATEnum,BJ2005_MISR_AER(:,4),:ks,LineWidth,1,MarkerEdgeColor,m,MarkerFaceColor,m,MarkerSize,5)holdonplot(DATEnum,BJ2005_MISR_AER(:,8),:ko,LineWidth,1,MarkerEdgeColor,b,MarkerFaceColor,b,MarkerSize,5)附加繪圖程序:date=070427;station=bj;n=size(date,1);c=strcat(station,date);a=load(D:BJDOASbj2,c,
7、.dat);figure(Position,1,1,800,800);plot(1:288,a(:,6),*-r,LineWidth,2.5);holdonplot(1:288,a(:,8),o-b,LineWidth,2.5);plot(1:288,a(:,10),-k,LineWidth,2.5);holdoffYLabel(fontsize16MixingRatio(ppb);XLabel(fontsize16Hours);Title(fontsize14,date(1:2),/,date(3:4),/,date(5:6);Legend(fontsize14SO_2,fontsize14
8、NO_2,fontsize14O_3);legend(boxoff);XLim(0.5,288.5);%YLim(0,max(a(:,6),a(:,8),a(:,10)*1.2);set(gca,xtick,0.5:24:288.5,xticklabel,0:2:24,fontsize,12);saveas(gcf,D:BJDOASbj5,c,.emf);close;2)文本標(biāo)注Ht=text(0,0,fontsize12alpha=0.3)set(ht,Color,k,HorizontalAlignment,Center)3)雙坐標(biāo)軸繪制I)粗略繪制set(gca,TickLength,0.
9、015;0.015)set(gca,position,0.2);axis(0,4000,-15,20,0,100);AX,H1,H2=plotyy(upair2(1:7,3),upair2(1:7,4),upair2(1:7,3),upair2(1:7,6)set(H1,Color,k);%set(H1,XMinorTick,on);axes(Position,get(AX(1),Position),XColor,k,YColor,k)set(H2,Color,k,LineStyle,:);title(10-02)II)精確繪制tp:壓力變量tt:溫度變量clfreset,h_ap=axes(
10、position,0.13,0.13,0.7,0.75);set(h_ap,Xcolor,b,Ycolor,b,Xlim,0,5,Ylim,0,15);nx=10;ny=6;%為兩套坐標(biāo)系定義共同的坐標(biāo)刻度分段數(shù)。pxtick=0:(5-0)/nx:5;pytick=0(15-0)/ny):15;set(h_ap,Xtick,pxtick,Ytick,pytick,Xgrid,on,Ygrid,on)%保證坐標(biāo)系按約定分段數(shù)刻度;h_linet=line(tp,yp,Color,b);set(get(h_ap,Xlabel),String,時(shí)間rightarrow分)set(get(h_ap,
11、Ylabel),String,壓力rightarrow(times105pa))h_at=axes(position,get(h_ap,Position);%保證兩套坐標(biāo)系重合的技巧。set(h_at,Color,none,Xcolor,r,Ycolor,r);保證重合坐標(biāo)系都可見的技術(shù),使得后面產(chǎn)生的h_at軸背景“無(wú)色透明,而不遮蓋前面的圖像。set(h_at,Xaxislocation,top)%把第二套坐標(biāo)系的橫軸設(shè)置在軸位框的“頂邊”,把縱軸設(shè)置在軸位的“右%邊”,而且增值%的方向是自上而下的set(h_at,Yaxislocation,right,Ydir,rev)set(get(
12、h_at,Xlabel),String,時(shí)間rightarrow分)set(get(h_at,Ylabel),String,壓力rightarrow(times105pa))set(h_at,Ylim,0,210)line(tt,yt,Color,r,Parent,h_at);%確保溫度曲線繪制在h_at坐標(biāo)中xpm=get(h_at,Xlim);%獲取h_at坐標(biāo)系橫軸的取值范圍。txtick=xpm(1):(xpm(2)-xpm(1)/nx):xpm(2);tytick=0:(210-0)/ny):210;set(h_ap,Xtick,txtick,Ytick,tytick)4)繪制多個(gè)圖
13、形,在一張圖上ff=figure(ss)h1=subplot(3,1,1)plot(modis_spr(:,1),modis_spr(:,3),g-)xlim(2000.52006.5)ylim(01.5)holdonplot(modis_sum(:,1),modis_sum(:,3),r-o)holdonplot(modis_aut(:,1),modis_aut(:,3),y-)holdonplot(modis_win(:,1),modis_win(:,3),b-*)legend(MAM,JJA,SON,DJF,Orientation,horizontal)legend(boxoff)%le
14、gend()title(ZHANDIANss,:)set(h1,position,0.1,0.65,0.6,0.2)set(gca,ytick,0:0.5:1.5,yticklabel,0.0;0.5;1.0;1.5,xticklabel,fontsize,10)ylabel(AODat550nm)set(gca,yminortick,on);set(gca,TickLength,0.02;0.02);h2=subplot(3,1,2)plot(spr(:,1),spr(:,4),g-)xlim(2000.52006.5)holdonplot(sum(:,1),sum(:,4),r-o)hol
15、donplot(aut(:,1),aut(:,4),y-)holdonplot(win(:,1),win(:,4),b-*)%set(gca,yticklabel,0.0,xticklabel,)set(h2,position,0.1,0.45,0.6,0.2,fontsize,10)set(gca,xticklabel,)set(gca,yminortick,on);set(gca,TickLength,0.02;0.02);set(gca,TickLength,0.02;0.02,YAxisLocation,right);ax=axes(Position,get(gca,Position)
16、,.YAxisLocation,left,.Color,none,xlim,get(gca,xlim),.ylim,get(gca,ylim),yticklabel,);ylabel(PM10,);%寫成兩行set(gca,yminortick,on,fontsize,10);set(gca,TickLength,0.02;0.02);h3=subplot(3,1,3)plot(spr(:,1),spr(:,3),g-)xlim(2000.52006.5)ylim(0200)holdonplot(sum(:,1),sum(:,3),r-o)holdonplot(aut(:,1),aut(:,3
17、),y-)holdonplot(win(:,1),win(:,3),b-*)set(h3,position,0.1,0.25,0.6,0.2)set(gca,xticklabel,2001:1:2006,fontsize,10)set(gca,TickLength,0.01;0.01);xlabel(year)ylabel(API)set(gca,yminortick,on,fontsize,10);set(gca,TickLength,0.02;0.02);%saveas(ff,E:resultseason_figure,sitess,:,season_modis.emf);%saveas(
18、ff,E:resultseason_figure,sitess,:,season_modis.eps);2、相關(guān)系數(shù)計(jì)算rs=corrcoef(x,y)3、氣溶膠插值程序wt=log(0.44/0.47)/log(0.659/0.47)taer44=raddata(ii,20)*(raddata(ii,19)/raddata(ii,20)*wt4、%計(jì)算大氣層頂向上和地面向下輻射通量的反射率fori=1:xh_num%solardistance:日地距離xxx=2*3.1416*(xh_total(i,5)-1)/365;solardistance(i)=1.000109+0.033494*c
19、os(xxx)+0.001472*sin(xxx)+0.000768*cos(2*xxx)+0.000079*sin(2*xxx);%計(jì)算日地距離的比值albupflux(i)=xh_total(i,18)/(solardistance(i)*solardistance(i)*xh_total(i,25)*1366);%計(jì)算大氣層頂?shù)姆凑章蔭lbdownflux(i)=xh_total(i,22)/(solardistance(i)*solardistance(i)*xh_total(i,25)*1366);%計(jì)算透過(guò)End6、插值程序loadE:ceresskytoaoutputHuabei
20、totalflux1002.dat;datafile=totalflux1002toa_new=zeros(81,81);lat=zeros(81,81);lon=zeros(81,81);forn=1:81lat(1:81,n)=42:-0.05:38;lon(n,1:81)=115:0.05:119;endZI=zeros(81,81);form=1:81forn=1:81%ZI(m,n)=interp2(bb,dd,ff,lon(m,n),lat(m,n);ZI(m,n)=griddata(datafile(:,7),datafile(:,8),datafile(:,11),lon(m,
21、n),lat(m,n);%進(jìn)行插值endend7計(jì)算平均值%利用07年1月1113日的北京站aeronet數(shù)據(jù)來(lái)標(biāo)定五臺(tái)光度計(jì)的敏感性參數(shù)clear;clc;loadE:sunphometersunprogramCIMEL_SUN_070113.mat%對(duì)于手持光度計(jì),01號(hào):55列為440nm%_給出變量的行數(shù)和列數(shù)line01,col01=size(sun01_data);line02,col02=size(sun02_data);line10,col10=size(sun10_data);line11,col11=size(sun11_data);lineLOA,colLOA=size(
22、sunLOA_data);lineBJ,colBJ=size(Beijing_data);%01#光度計(jì)標(biāo)定day=11;12;13;sun_num=0;sun_num2=0;SUN01=0;forj=1:line01%判斷所測(cè)數(shù)據(jù)值間隔時(shí)間,間隔小于6分鐘,求平均,認(rèn)為是一次觀測(cè)if(j=1)day=sun01_data(j,4);time=sun01_data(j,5)+sun01_data(j,6)/60;endif(day=sun01_data(j,4)difference=(sun01_data(j,5)+sun01_data(j,6)/60)-time;if(difference0
23、.05)sun_num2=sun_num2+1;sun01_mean(sun_num2,:)=SUN01/sun_num;sun_num=1;SUN01=sun01_data(j,:);time=sun01_data(j,5)+sun01_data(j,6)/60;%由于判斷difference0.1要多循環(huán)一次,所以必須減去一次循環(huán)endelseif(day=sun01_data(j,4)sun_num2=sun_num2+1;sun01_mean(sun_num2,:)=SUN01/sun_num;sun_num=1;SUN01=sun01_data(j,:);time=sun01_dat
24、a(j,5)+sun01_data(j,6)/60;day=sun01_data(j,4);endendsun_num2=sun_num2+1;sun01_mean(sun_num2,:)=SUN01/sun_num;%sun01_mean為最終輸出變量,為每個(gè)時(shí)間段記錄的平均%_9、讀文件ddate=01;02;03;04;05;06;07;08;09;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31;fid=fopen(E:atmosphereoutputximeng200701shanghai_ACS_M_
25、Z_54102_200701,ddate(dday,:),.out,r);iffid=-1%判斷要讀取的文件是否存在ddd=str2num(ddate(dday,:);data=fscanf(fid,%i%i%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f,28inf);data=data;d_n,bb=size(data);10、hdf文件讀取Hdf-EOSGRIDDATAMISR:Name:AerosolParameterAverageDimensions:Name:YDimSize:360Name:XDimSize:720Name:
26、AlgorithmTypeSize:8TileDimensions:4590UpperLeftGridCorner:-18000000090000000LowerRightGridCorner:180000000-90000000Rows:360.0Columns:720.0Projection:geoZoneCode:-1.0Sphere:Clarke1866ProjectionParameters:OriginCode:ulPixelRegistrationCode:center直接讀取:Optical_depth_average=hdfread(E:MISRMISR_AM1.hdf,Ae
27、rosolParameterAverage,Fields,Opticaldepthaverage)%按照INDEX讀取:Optical_depth_average=hdfread(E:MISRMISR_AM1.hdf,AerosolParameterAverage,Fields,Opticaldepthaverage,Index,1.01.01.0,1.01.01.0,360.0720.08.0);%按照地理坐標(biāo)讀?。篛ptical_depth_average=hdfread(E:MISRMISR_AM1.hdf,AerosolParameterAverage,Fields,Opticalde
28、pthaverage,Box,80.0,100.0,70.0,50.0);按Interpolate讀取Optical_depth_average=hdfread(E:MISRMISR_AM1.hdf,AerosolParameterAverage,Fields,Opticaldepthaverage,Interpolate,80.0,100.0,70.0,50.0);11、hdfswath數(shù)據(jù)讀取mod28L2File=MOD28L2.A2001185.0830.003.2001308112641.hdf;sstInfo=hdfinfo(mod28L2File,eos);sstSwath=ss
29、tInfo.Swath;idx=11,44,;%Subsetby4ineachdimensionsst=hdfread(sstSwath,Fields,sst,Index,idx);%RmonFlags=hdfread(sstSwath,Fields,common_flags,Index,idx);land=(bitget(commonFlags,8)=1);%ReadSSTattributes:scaleandunits.sstInfoHDF=hdfinfo(mod28L2File);datasets=sstInfoHDF.Vgroup.Vgroup(2).SDS;sstDataset=da
30、tasets(strmatch(sst,datasets.Name,exact);%exact:準(zhǔn)確匹配sstAttr=sstDataset.Attributes;sstSlope=double(sstAttr(strmatch(Slope,sstAttr.Name).Value)sstIntercept=double(sstAttr(strmatch(Intercept,sstAttr.Name).Value)sstUnits=sstAttr(strmatch(Units,sstAttr.Name).Value%ReadMODISgeolocationdatafields.mod03File
31、=MOD03.A2001185.0830.003.2001305034045.hdf;geoInfo=hdfinfo(mod03File,eos);sstLat=double(hdfread(geoInfo.Swath,Fields,Latitude,Index,idx);sstLon=double(hdfread(geoInfo.Swath,Fields,Longitude,Index,idx);sstLat(sstLat=-999)=NaN;sstLon(sstLon=-999)=NaN;12、繪制colormap%Loadthecolormapanddisplayastandardcol
32、orbar.loadcolormapscmap=sstCmap;ndviCmap;%Wesavedourcolormapintwoequalpartsfigure%firstfigurecolormap(cmap)set(axes,Visible,off)h=colorbar(horiz);set(get(h,Title),String,StandardColorbar)13、讀文件,去除頭文件fid=fopen(E:ExperimentalData試驗(yàn)數(shù)據(jù)LidarData2006-082006-08-03-Runresult,data1(i,1).name,r);iffid=-1temp=
33、fgetl(fid);data=fscanf(fid,%f%f%f%f%f%f%f%f,81000);%將數(shù)據(jù)倒過(guò)來(lái)endendnewname2=num2str(k),h;xlswrite(E:ExperimentalData試驗(yàn)數(shù)據(jù)LidarData2006-082006-08-03-Runm,newname2,NuuH);14、多項(xiàng)式擬合及圖形繪制X=0:0.1:1;y=3457.89101113.315;Dy=0.15;fori=1:6a,S=POLYFIT(x,y,n);An=a;da=dy*sqrt(diag(inv(S.R*S.R)%計(jì)算個(gè)系數(shù)的誤差DAn=da;freedom(n
34、)=S.df%記錄自由度ye,delta=polyval(a,x,S);%計(jì)算擬和多項(xiàng)式的范圍YEn=ye;Dn=delta;Chi2(n)=sum(y-ye).2/dy/dy%計(jì)算不同階次的x2量endQ=1-chicdf(chi,freedom);%用于判斷擬合良好度Subplot(1,2,1),plot(1:6,abs(chi2-freedom),b)xlabel(階次),title(chi2與自由度)subplot(1,2,2),plot(1:6,Q,r,1:6,ones(1:6)*0.5)xlabel(階次),title(Q與0.5線)clf,plot(x,y,b+)errorbar
35、(x,YE3,D3,r)text(0.1,5.5,;text(0.1,5,f)15、如何讀文本文件fidin=fopen(test2.txt);%打開test2.txt文件fidout=fopen(mkmatlab.txt,w);%創(chuàng)建MKMATLAB.txt文件whilefeof(fidin)%判斷是否為文件末尾tline=fgetl(fidin);%從文件讀行ifdouble(tline(1)=48&double(tline(1)=57)%判斷首字符是否是數(shù)值fprintf(fidout,%snn,tline);%如果是數(shù)字行,把此行數(shù)據(jù)寫入文件MKMATLAB.txtcontinue%如果是
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 企業(yè)獨(dú)棟總部出售合同范例
- 簽約合同范例
- 勞務(wù)派遣進(jìn)廠合同范例
- 2025簡(jiǎn)單版重慶購(gòu)房合同
- 工程預(yù)算施工合同范例
- 勞務(wù)總包大合同范例
- 土地簽約合同范例
- 橋梁木工班組勞務(wù)合同范例
- 快速簽約洽談合同范例
- 銅仁職業(yè)技術(shù)學(xué)院《地震地質(zhì)綜合解釋》2023-2024學(xué)年第一學(xué)期期末試卷
- 智能網(wǎng)聯(lián)車路云協(xié)同系統(tǒng)架構(gòu)與關(guān)鍵技術(shù)研究綜述
- 24春國(guó)家開放大學(xué)《地域文化(本)》形考任務(wù)1-4參考答案
- 2023流域超標(biāo)準(zhǔn)洪水防御預(yù)案編制導(dǎo)則
- 高等數(shù)學(xué)(高職教育)全套教學(xué)課件
- 瑞幸咖啡品牌營(yíng)銷策略研究報(bào)告
- 醫(yī)學(xué)科研的道德與倫理
- 統(tǒng)編版語(yǔ)文八年級(jí)下冊(cè)全冊(cè)大單元整體教學(xué)設(shè)計(jì)表格式教案
- 蒙牛學(xué)生奶培訓(xùn)課件
- 檢驗(yàn)原始記錄培訓(xùn)課件
- 少先隊(duì)小提案
- 小學(xué)一年級(jí)上冊(cè)數(shù)學(xué)口算訓(xùn)練題
評(píng)論
0/150
提交評(píng)論