?? blocknormalize.m
字號:
function [x,a]=blocknormalize(x)
% The function BLOCKNORMALIZE normalizes each block of the input signal,
% as defined by zero crossings, to have a maximum amplitude of 1.
%
% Suggestion: if the routine is needed than use it with caution,
% since at least 2 problems have been encountered and corrected
% during the test: syntax error and envelope not flipped.
%
% Calling sequence-
% [x,a]=blocknormalize(x)
%
% Input-
% x - 2-D matrix data(npt,ncol)
% Output-
% x - 2-D matrix of normalized data
% a - 2-D matrix of envelope
%
% Used by-
% FA
% Kenneth Arnold (NASA GSFC) Summer 2003 Initial
% J.Marshak (NASA GSFC) March 10, 2004 Modified
% (Corrected syntax error, flip envelope if data flipped)
% Kenneth Arnold (NASA GSFC) June 6, 2004 Tweaked
%----- Get the dimension
[npt,ncol] = size(x);
%----- Flip data if needed
flipped=0;
if (ncol > npt)
x=x';
[npt,ncol] = size(x);
flipped=1;
end
%----- Initialize amplitude matrix
a = ones(npt,ncol);
%----- Process each column of data
for col=1:ncol
i=1;
while (i<=npt)
blockSign = sign(x(i,col));
while (blockSign == 0 & i < npt) % handle zero case
i=i+1;
blockSign = sign(x(i,col));
end
if (i==npt)
break;
end
blockExtr = 0; % extreme value (maximum or minimum)
%----- Find the end of this block and its extreme value
for (j=i:npt)
cur = x(j,col);
if (sign(cur) ~= blockSign)
j=j-1;
break;
end
if ((blockSign == 1 & cur > blockExtr) | (blockSign == -1 & cur < blockExtr))
blockExtr = cur;
end
end
if (blockExtr ~= 0)
x(i:j,col) = x(i:j,col) / blockExtr * blockSign;
a(i:j,col) = a(i:j,col) * blockExtr * blockSign;
end
i=j+1;
end
end
%----- Flip data back if needed
if (flipped)
x=x';
a=a';
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -