-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabsZscore.m
52 lines (42 loc) · 1.5 KB
/
absZscore.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function envelope_resample (block)
% Level-2 MATLAB file S-Function for times two demo.
% Copyright 1990-2009 The MathWorks, Inc.
% $Revision: 1.1.6.2 $
setup(block);
function setup(block)
%%
block.RegBlockMethod('SetInputPortDimensions', @SetInpPortDims);
%% Register number of input and output ports
block.NumInputPorts = 1;
block.NumOutputPorts = 1;
%% Setup functional port properties to dynamically
% block.InputPort(1).Dimensions = 32000;
block.OutputPort(1).Dimensions = 256;
%%
block.SetPreCompPortInfoToDefaults;
%% inherited.
block.SetPreCompInpPortInfoToDynamic;
block.SetPreCompOutPortInfoToDynamic;
block.InputPort(1).DirectFeedthrough = true;
%% Set block sample time to inherited
block.SampleTimes = [-1 0];
%% Set the block simStateCompliance to default (i.e., same as a built-in block)
block.SimStateCompliance = 'DefaultSimState';
%% Register methods
block.RegBlockMethod('Start',@Start);
block.RegBlockMethod('Outputs',@Output);
end
function Start(block)
disp('hi')
end
%%
function SetInpPortDims(block,idx,dim)
block.InputPort(1).Dimensions = [256 1];
block.OutputPort(1).Dimensions = [256 1];
end
function Output(block)
x = block.InputPort(1).Data;
x_zscore = zscore(abs(x'));
block.OutputPort(1).Data = x_zscore';
end
end