forked from bw1129/PIDtoolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PTscale2ref.m
18 lines (14 loc) · 890 Bytes
/
PTscale2ref.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function [scaledOutput] = PTscale2ref(inputSig,inputRef)
%% [scaledSig] = PTscale2ref(sig,ref)
% Normalizes an input signal [inputSig] relative to a reference signal [inputRef]
% ----------------------------------------------------------------------------------
% "THE BEER-WARE LICENSE" (Revision 42):
% <[email protected]> wrote this file. As long as you retain this notice you
% can do whatever you want with this stuff. If we meet some day, and you think
% this stuff is worth it, you can buy me a beer in return. -Brian White
% ----------------------------------------------------------------------------------
c=1;% constant, scaling factor, though probably unnecessary
mRef = mean(abs(inputRef)); stdRef = std(abs(inputRef));
mSig = mean(abs(inputSig)); stdSig = std(abs(inputSig));
scaledOutput = (((inputSig - mSig)/stdSig) * stdRef + mRef) * c;
end