forked from orcioni/Volterra2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Wiener2Volterra_20.m
executable file
·120 lines (101 loc) · 3.79 KB
/
Wiener2Volterra_20.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
% function [h0,h1,h2,...,hp]=Wiener2Volterra(A, k0, k1, k2, k3, k4, k5)
%
% Volterra kernels h0,h1,h2,...,h5 are obtained from Wiener kernels.
% A is a vector of the power of the zero-mean white gaussian input used
% for Wiener identification of different order kernels.
% See Documentation and References provided.
%
% If you want to contact the authors, please write to [email protected],
% or Simone Orcioni, DII, Università Politecnica delle Marche,
% via Brecce Bianche, 12 - 60131 Ancona, Italy.
% If you are using this program for a scientific work, we encourage you to cite
% the following paper (the file cite.bib, containing the reference in bibtex
% format is also provided):
%
% Simone Orcioni. Improving the approximation ability of Volterra series
% identified with a cross-correlation method. Nonlinear Dynamics, 2014.
%
%Orcioni, S., Terenzi, A., Cecchi, S., Piazza, F., & Carini, A. (2018).
% Identification of Volterra Models of Tube Audio Devices using
% Multiple-Variance Method. Journal of the Audio Engineering Society,
% 66(10), 823–838. https://doi.org/10.17743/jaes.2018.0046
% Copyright (C) 2006 Massimiliano Pirani
% Copyright (C) 2017 Simone Orcioni
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License along
% with this program; if not, write to the Free Software Foundation, Inc.,
% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
function varargout=Wiener2Volterra_20(delays,A,k0,k1,k2,k3,k4,k5)
if exist('k1','var')
if size(k1,1)==1,k1=k1';end
end
switch nargin
case 3 % zero
varargout{1}=k0;
case 4 % first order
varargout{1}=k0;
varargout{2}=k1;
case 5 % second order
varargout{1}=k0+k02f(k2,A(1));
varargout{2}=k1;
varargout{3}=k2;
case 6 % third order
R1=size(k1,1);
R3=size(k3,1);
varargout{1}=k0+k02f(k2,A(1));
varargout{2}=[k1;zeros(R3-R1,1)]+[zeros(delays(3),1);k13f(k3,A(2));zeros(R1-R3-delays(3),1)];%h1
varargout{3}=k2;%h2
varargout{4}=k3;%h3
case 7 % fourth order
R1=size(k1,1);
R2=size(k2,1);
R3=size(k3,1);
R4=size(k4,1);
varargout{1}=k0+k02f(k2,A(1))+k04f(k4,A(1));%h0
varargout{2}=[k1;zeros(R3-R1,1)]+[zeros(delays(3),1);k13f(k3,A(2));zeros(R1-R3-delays(3),1)];%h1
kz=zeros(max([R4,R2]));
kz(1:R2,1:R2)=k2;k2=kz;
kz=zeros(max([R4,R2]));
k24=k24f(k4,A(3));
kz(1+delays(4)-delays(2):R4+delays(4)-delays(2),1+delays(4)-delays(2):R4+delays(4)-delays(2))=k24;k24=kz;
varargout{3}=k2+k24;%h2
varargout{4}=k3;%h3
varargout{5}=k4;%h4
case 8 % fifth order
R1=size(k1,1);
R2=size(k2,1);
R3=size(k3,1);
R4=size(k4,1);
R5=size(k5,1);
R135=max([R1,R3,R5]);
R24=max([R2,R4]);
R35=max([R3,R5]);
varargout{1}=k0+k02f(k2,A(1))+k04f(k4,A(1));%h0
varargout{2}=[k1;zeros(R135-R1,1)]+[k13f(k3,A(2));zeros(R135-R3,1)]+[k15f(k5,A(2));zeros(R135-R5,1)];%h1
kz=zeros(R24);
kz(1:R2,1:R2)=k2;k2=kz;
kz=zeros(R24);
k24=k24f(k4,A(3));
kz(1:R4,1:R4)=k24;k24=kz;
varargout{3}=k2+k24;%h2
kz=zeros(R35,R35,R35);
kz(1:R3,1:R3,1:R3)=k3;k3=kz;
k35=k35f(k5,A(4));
kz=zeros(R35,R35,R35);
kz(1:R5,1:R5,1:R5)=k35;k35=kz;
varargout{4}=k3+k35;%h3
varargout{5}=k4;%h4
varargout{6}=k5;%h5
otherwise
error('input parameter number is not valid');
end