NASA wind 数据: http://cdaweb.gsfc.nasa.gov/
code:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1
%准备数据(x:time, y:data)
start_=datenum('2015-05-21 00:00:00','yyyy-mm-dd HH:MM:SS');
end_=datenum('2015-05-30 00:00:00','yyyy-mm-dd HH:MM:SS');
x1=linspace(start_,end_,226235);
x2=linspace(start_,end_,222017);
bx=importdata('bx.txt');
vpx=importdata('vx.txt');
%plotyy方法作图
figure(1);
subplot(7,1,1);
[ax,h1,h2]=plotyy(x1,bx,x2,vpx);
datetick('x','yyyy/mm/dd','keepticks'); %设置时间显示
set(ax(1),'ylim',[-15,15],'yTick',[-15:5:15]); %设定左Y坐标范围,注意刻度步长设置要冒号,而不是逗号
set(ax(2),'ylim',[-900,-300],'yTick',[-900:100:-300]); %设定右Y坐标范围
set(gca,'linewidth',1,'fontsize',10,'fontname','Times'); %设置刻度大小
set(ax(1),'fontsize',5); % 'Xcolor','k','Ycolor','k'
set(ax(2),'fontsize',5); % 'Xcolor','k','Ycolor','k'
set(h1,'linestyle','-','color','b'); %设置数据线条
set(h2,'linestyle','-','color','r');
title('SIR1 HSS1 SIR2 HSS2 SIR3 HSS3','FontName','宋体','FontSize',15,'FontWeight','bold');
%xlabel(ax(1),'time','FontName','宋体','FontSize',12,'FontWeight','bold');
%ylabel(ax(1),'Bx(nT)','FontName','Times New Romance','FontSize',12,'FontWeight','bold');
%ylabel(ax(2),'Vpx(km/s)','rotation',-90,'FontName','Times New Romance','FontSize',5,'FontWeight','bold');
set(get(ax(1),'ylabel'),'string','Bx(nT)','fontsize',5);
set(get(ax(2),'ylabel'),'string','Vpx(km/s)','fontsize',5);
%text(736113,0,'x','rotation',270);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2
by=importdata('by.txt');
vpy=importdata('vy.txt');
subplot(7,1,2);
[ax,h1,h2]=plotyy(x1,by,x2,vpy);
datetick('x','yyyy/mm/dd','keepticks');
set(ax(1),'ylim',[-15,15],'yTick',[-15:5:15]);
set(ax(2),'ylim',[-150,150],'yTick',[-150:50:150]);
set(gca,'linewidth',1,'fontsize',10,'fontname','Times');
set(ax(1),'fontsize',5);
set(ax(2),'fontsize',5);
set(h1,'linestyle','-','color','b');
set(h2,'linestyle','-','color','r');
set(get(ax(1),'ylabel'),'string','By(nT)','fontsize',5);
set(get(ax(2),'ylabel'),'string','Vpy(km/s)','fontsize',5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 3
bz=importdata('bz.txt');
vpz=importdata('vz.txt');
subplot(7,1,3);
[ax,h1,h2]=plotyy(x1,bz,x2,vpz);
datetick('x','yyyy/mm/dd','keepticks');
set(ax(1),'ylim',[-15,15],'yTick',[-15:5:15]);
set(ax(2),'ylim',[-150,150],'yTick',[-150:50:150]);
set(gca,'linewidth',1,'fontsize',10,'fontname','Times');
set(ax(1),'fontsize',5);
set(ax(2),'fontsize',5);
set(h1,'linestyle','-','color','b');
set(h2,'linestyle','-','color','r');
set(get(ax(1),'ylabel'),'string','Bz(nT)','fontsize',5);
set(get(ax(2),'ylabel'),'string','Vpz(km/s)','fontsize',5);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4
start_=datenum('2015-05-21 00:00:00','yyyy-mm-dd HH:MM:SS');
end_=datenum('2015-05-30 00:00:00','yyyy-mm-dd HH:MM:SS');
x4=linspace(start_,end_,6909);
b=importdata('B.txt');
b=b(b>-10 & b<10); %异常数据处理
subplot(7,1,4);
plot(x4,b,'k-');
datetick('x','yyyy/mm/dd','keepticks');
set(gca,'linewidth',1,'fontsize',10,'fontname','Times');
set(gca,'FontSize',5)
ylim([0 15]);
set(gca,'ytick',[0:3:15]);
ylabel('B(nT)')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5
start_=datenum('2015-05-21 00:00:00','yyyy-mm-dd HH:MM:SS');
end_=datenum('2015-05-30 00:00:00','yyyy-mm-dd HH:MM:SS');
x5=linspace(start_,end_,8441);
Np=importdata('Np.txt');
subplot(7,1,5);
plot(x5,Np,'k-');
datetick('x','yyyy/mm/dd','keepticks');
set(gca,'linewidth',1,'fontsize',10,'fontname','Times');
set(gca,'FontSize',5);
set(gca,'ylim',[0 18]);
set(gca,'ytick',[0:3:18]);
ylabel('Np(cm-3)')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6
start_=datenum('2015-05-21 00:00:00','yyyy-mm-dd HH:MM:SS');
end_=datenum('2015-05-30 00:00:00','yyyy-mm-dd HH:MM:SS');
x6=linspace(start_,end_,8441);
Tp=importdata('Tp.txt');
subplot(7,1,6);
plot(x6,Tp,'k-');
datetick('x','yyyy/mm/dd','keepticks');
set(gca,'linewidth',1,'fontsize',10,'fontname','Times');
set(gca,'FontSize',5);
set(gca,'ylim',[0 60]);
set(gca,'ytick',[0:10:60]);
ylabel('Tp(10^5K)')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7
start_=datenum('2015-05-21 00:00:00','yyyy-mm-dd HH:MM:SS');
end_=datenum('2015-05-30 00:00:00','yyyy-mm-dd HH:MM:SS');
x7=linspace(start_,end_,8416);
B=importdata('B.txt');
B(any(isnan(B),2),:)=[0];
Np=importdata('Np.txt');
Np(any(isnan(Np),2),:)=[0];
Ne=importdata('Ne.txt');
Ne(any(isnan(Ne),2),:)=[0];
Na=importdata('Na.txt');
Na(any(isnan(Na),2),:)=[0];
Tp=importdata('Tp.txt');
Tp(any(isnan(Tp),2),:)=[0];
Te=importdata('Te.txt');
Te(any(isnan(Te),2),:)=[0];
Ta=importdata('Ta.txt');
Ta(any(isnan(Ta),2),:)=[0];
Pt11=(B*10^(-9)).^2./(2*4*pi/(10^7));
Pt1=Pt11*10^(12);
Pt21=(Np*10^(6)).*(Tp*11605)*1.38*10^(-23); % for proton
Pt22=(Ne*10^(6)).*(Te*11605)*1.38*10^(-23); %for electron
Pt23=(Na*10^(6)).*(Ta*11605)*1.38*10^(-23); % for alpha
Pt2=(Pt21+Pt22+Pt23)*10^(12);
Pt=Pt1+Pt2;
Pt=Pt(Pt>-10 & Pt<1000);
%disp(Pt);
subplot(7,1,7);
plot(x7,Pt,'k-');
datetick('x','yyyy/mm/dd','keepticks');
set(gca,'linewidth',1,'fontsize',10,'fontname','Times');
set(gca,'FontSize',5);
set(gca,'ylim',[0 150]);
set(gca,'ytick',[0:30:150]);
ylabel('Pt(pPa)')
%tickv =start_:8416:end_;
%set(gca,'XTick',tickv);
%set(gca,'XTickMode','manual');
%set(gca,'XTickLabelMode','manual');
%tickstr = ones(length(tickv(:)),5)*32;
%tickstr = num2str((start_:8416:end_).');
%tickstr = char(tickstr);
%set(gca,'XTickLabel',tickstr);
%set(gca,'XMinorTick','on')
%drawnow;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(2);
参考:
https://blog.csdn.net/charie411/article/details/72675873
https://www.cnblogs.com/jeromeblog/p/3396494.html
https://blog.csdn.net/shanchuan2012/article/details/72882934
https://jingyan.baidu.com/article/37bce2be63d4bf1002f3a23e.html
http://bilu.blog.163.com/blog/static/176178129201182943032724/
https://ww2.mathworks.cn/help/index.html
https://www.w3cschool.cn/matlab/matlab-axsl28iz.html