-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshape
30 lines (26 loc) · 837 Bytes
/
shape
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
function [ A, C, ASE ] = shape( B, D, LA )
%SHAPE Is shaping filter
% Inputs: B input sequence
% D desired output sequence
% LA length of shaping filter
% Outputs: A coefficients of shaping filter
% C actual output of filter
% ASE average squared error between desired and actual
% output of filter
% Author: Felix Zhang
% Last modified: 2018-4-9
% References:
% [1] M. T. Silvia, and E. A. Robinson (1979) "Deconvolution of Geophysical Time
% Series in the Exploration for Oil and Natural Gas".
LB = length(B);
LD = length(D);
[R, lags] = xcorr(B, B, LA-1);
R = R(lags>=0);
[G, lags] = xcorr(D, B, LA-1);
G = G(lags>=0);
A = eureka(R, G);
C = conv(B, A);
DD = dot(D, D);
AG = dot(A, G);
ASE = (DD-AG)/DD;
end