%画图~以f为横坐标,功率谱值为纵坐标,但是把相应位置的f改成对应周期,f本身画到上面的横坐标去
position = [0.1 0.15 0.8 0.3];
%
plot(east_ciso_f, east_ciso_S ,LineWidth=2) % 连续功率谱
ylim([-0.01 0.1]);%xlim([1/365 0.5])
hold on; plot(east_ciso_f, sw, 'r--',LineWidth=2) % 检验线
%set second xtick~~~
xticks([0 1/30 1/15 0.1 0.2 0.3 0.5]);%想显示的值标出来
f = xticks;
xticklabels(sprintfc('%.0f',1./f));%精度保留0位小数~f换成倒数就是周期啦~
set(gca,'xaxislocation','bottom','position',position);
xlabel('period (days)')
%x of f on the top:
axes;
plot(east_ciso_f,east_ciso_S,LineWidth=2 ) % 连续功率谱
hold on; plot(east_ciso_f, sw, 'r--',LineWidth=2) % 检验线
set(gca,'xaxislocation','top','position',position);
ylim([-0.01 0.1])% xlim([2 30]);
legend('功率谱S','红噪声谱Sw')
xlabel('频率f') ;ylabel('power spectrum') ;
%
% line of time
subplot("Position",[0.1 0.6 0.8 0.3])
plot(x,east_ciso,LineWidth=2)
xlim([x(1) x(365)]) %去掉了两头留白
datetick('x','mm','keeplimits') %datetick('x','mm','keepticks')%这比上一条指令在末尾多了个1
hold on
p=refline([0 mean(east_ciso)]); %参考线
set(p,"Color",'green','LineWidth',2)
title('东区多年平均时间序列');
03-16
2万+
11-18
3182