Created
September 8, 2017 22:13
-
-
Save npyoung/b22daecc0c3f835170f74c1c7145cdba to your computer and use it in GitHub Desktop.
MATLAB utils
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [ y ] = butterfilter( x, cut, fs, type ) | |
%BUTTEFILTER Apply a Butterworth filter | |
nyq = fs / 2; | |
cutf = cut / nyq; | |
if nargin == 4 | |
[b, a] = butter(5, cutf, type); | |
elseif nargin == 3 | |
[b, a] = butter(5, cutf); | |
end | |
y = filtfilt(b, a, x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function [ t ] = maketime( x, fs ) | |
%MAKETIME for your data | |
t = (0:size(x,1)-1) / fs; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment