How do I correctly match up the years? Going from 0-8000 to 2000-2020.

조회 수: 1 (최근 30일)
Lauren Pressley
Lauren Pressley 2021년 7월 1일
댓글: Star Strider 2021년 7월 1일
clear;
close all;
% Desired latitude
%for lat = 1:4
lat = 2;
% Cut-offs for the day band pass (i.e., 10 to 50 days)
ta=10;
tb=50;
dt=1; %Daily data
% Cut-offs for the spatial band pass (i.e, 4 to 12 degrees longitude)
xa=4;
xb=12;
dx=0.25; %0.25 degree resolution
% Select start end year
year1=2000;
year2=2020;
k=0;
for year=[year1:year2];
loadstring=['load C:\Users\laure\Desktop\MEA593\Project_MEA593/Combined_mw_v5_atlantic_' int2str(year) '.mat'];
eval(loadstring);
tm=sstmx;
ym=lat_actual;
xm=lon_actual;
%This part of the code grabs values along desired latitude. If there are
%two latitudes that are equally close, it picks the southern one. Also
%focuses on 60W to 20E longitude domain.
xm=xm(1:273);
iy=min(find(abs(ym-lat)<0.25)); % Find nearest latitude.
ym=ym(iy);
tm=tm(:,1:273,iy);
[nt,nx]=size(tm);
tm(tm==-9999)=NaN;
if mod(year,4)==0, leap=1; else, leap=0; end;
tmyear(k+1:k+nt,:,:)=tm;
k=k+nt;
end;
[nt,nx,ny]=size(tmyear); k=nt;
% Fill in missing data %
tmyear=fillnan_new(xm,[1:nt],squeeze(tmyear));
% Temporal band pass
tmean=nanmean(tmyear);
tmyear=tmyear-ones(nt,1)*tmean;
tm50=get_lpass_bartlett(tmyear,tb,1);
tmbp=tmyear-tm50;
tmbp=get_lpass_bartlett(tmbp,ta,1);
tmbp=tmbp';
% Zonal band pass
tmean=nanmean(tmbp);
tmbp=tmbp-ones(nx,1)*tmean;
tmbp(isnan(tmbp)==1)=0;
tm48=get_lpass_bartlett(tmbp,xb/dx,1);
tmxtbp=tmbp-tm48;
tmxtbp=get_lpass_bartlett(tmxtbp,xa/dx,1);
tmxtbp=tmxtbp';
panel1=tmxtbp;
panel1(panel1==0)=NaN;
%Grabbing 323 - 355 degrees for 1N from xm
panel2 = panel1(:,93:226);
%Rows in panel2 correlating to time
for row = 1:7671
%Taking every row in panel2, taking nanmean of all lons to make 1 value
%for every row instead of having 134
panel3(row,1) = nanvar(panel2(row,:));
end
%Took time out on contour to make another column in panel3 to represent
%time values to plot easier
% panel3(:,2) = [0.5:1:nt-0.5]/365.25+year1;
figure(1); plot(panel3,'k','LineWidth',1)
title('Frequency');
xlabel('Time (Years)')
ylabel('SST Signal')
%set(gca,'XTickLabel',2000:2.5:2020)
This is what it looks like right now. Using gca doesn't really help. I know that last peak is corresponding to 2020.5 and the graph will end before it hits 2021, thus going all the way through 2020.
  댓글 수: 1
Star Strider
Star Strider 2021년 7월 1일
It would help to have a reasonably detailed description of the data, the objective, and desired result, as well as the .mat file itself.
What information would you want to have if you were seeing this for the first time and wanted to provide a solution?
.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by