Академический Документы
Профессиональный Документы
Культура Документы
% PLOT DATA
%----------------------------------------------------------------------
s4=xlsread('Data Asli.xlsx','Data CH','C2:C301');
%s4=xlsread('Data Asli.xlsx','Data Nino 3.4','C2:C301');
%s4=xlsread('Data Asli.xlsx','Data DMI','C2:C301');
%s4=xlsread('Data Asli.xlsx','Data AUSMI','C2:C301');
%s4=xlsread('Data Asli.xlsx','Data Temp','C2:C493');
%s4=s4(121:420,1:3);
%s4=xlsread('Data Asli.xlsx','Data Temp 83','C2:C301');
%display gambar
figure();
plot(s4,'r');
ylabel('Curah Hujan','Fontsize',12');
xlabel('Bulanan','Fontsize',12');
%----------------------------------------------------------------------
% DO FFT
%----------------------------------------------------------------------
s4=detrend(s4);
nt=length(s4(:,1));%number of data points used for the FFT computation.
t = (0:nt-1)';
%% 5) Plot the length (absolute value) of the fft power at each frequency
plot(f,abs(s4_pxx))
%Sort the rows of U so that the first row has ALL the lowest powered
%values at each frequency:
% U = sort(U);
%Plot the 95th row (e.g., "95% confidence limits") as well as the
%"raw" power spectrum (abs(s4_pxx) in this case):
%clv95ind = floor(.95*nr);
%clv95 = U(:,clv95ind)';
%figure(2)
%hold on
%plot(f,abs(s4_pxx),'k','LineWidth',2);
%plot(f,[clv95],'r','LineWidth',1);
%------------------------------------------------------------------------
% BandPass Filter
%------------------------------------------------------------------------
s4=s4-mean(s4);
dt=1;%sampling interval--> perhatikan time series data kita
fs=1/dt;%sampling frequency
fnyq=fs/2;%nayquist frequency
%-----------------------------
%LOW PASS
%-----------------------------
%iT=11;%cut off period-->memotong periode yg kita pengenin (Tahunan)
iT=28;%setengah tahunan
cf1=1/iT;%cut off frequency
[bl, al] = butter(4, cf1/fnyq, 'low'); %making window
%Do Low-pass
ylp=filtfilt(bl,al,s4);
%---------------------------
%HIGH PASS
%---------------------------
%iT=14;%cut off period-->memotong periode yg kita pengenin (Tahunan)
iT=64;%setengah tahunan
cf1=1/iT;%cut off frequency
[bl, al] = butter(5, cf1/fnyq, 'high'); %making window
%HIGH PASS
ylp_high=filtfilt(bl,al,ylp);%bl,al, window. y=fungsinya
%---------------------------------------------------------------------
% KORELASI
%---------------------------------------------------------------------
[r1,lag1]=crosscorr(ylp_high_index,ylp_high_data);
createfigure(lag1, r1);
%---------------------------------------------------------------------
% CUPLIK
%---------------------------------------------------------------------
s4=xlsread('Data Asli.xlsx','Data Temp','A2:C493');%Temperatur
s4_cuplik=s4(121:420,1:3);
%---------------------------------------------------------------------
% DATA HARIAN JADI BULANAN
%---------------------------------------------------------------------
clear all; close all; clc;
% Load data harian
harian_75 = xlsread('AUSMI_1973.xlsx','sheet3','B1:C366');
% Konversi harian-bulanan
tahun = 1975;
bulan = 1:12;
p = 1;
q = eomday(tahun(1),bulan(1));
for t = 1:length(tahun)
for b = 1:length(bulan)
bulanan(t,b) = nansum(harian_75(p:q)/q);
p = q + 1;
q = q + eomday(tahun(t),bulan(b));
end
end