-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremoveWRFLowFrequencies.m
36 lines (31 loc) · 1023 Bytes
/
removeWRFLowFrequencies.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function y_hf = removeWRFLowFrequencies(y)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function y_hf = removeROMSLowFrequencies(y)
%
% Removes low-frequency signal from ROMS point-value timeseries y, using a zero-phase
% 4th order Butterworth filter.
%
% Input arguments:
% y: timeseries of a variable from a gridpoint in ROMS
%
% Output:
% y_hf: high pass filtered timeseries
%
% cutOffPeriodInNormalizedUnits is cutOff period in minutes.
%
%
% Author: Matjaz Licer - NIB MBS @SOCIB
% Date of creation: May-2015
% Last modification: 18-Apr-2016
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
warning off;
% design 4th order Butterworth filter:
filterOrder=4;
cutOffPeriodInNormalizedUnits=40;
cutOffFrequency = 1/(cutOffPeriodInNormalizedUnits/2);
h=fdesign.highpass('N,F3dB',filterOrder,cutOffFrequency);
d1 = design(h,'butter');
% perform high pass filtering:
y_hf = filtfilt(d1.sosMatrix,d1.ScaleValues,...
naninterp(y));