Low-Level Nonlinearity Evaluation Using Wavenet (SISO System)
6 views (last 30 days)
Show older comments
Hello!
I'm trying to do a low-level nonlinearity evaluation to a NARX model based on wavenet estimator. This manipulation is based on http://www.mathworks.com/help/toolbox/ident/ug/bq5o_xw-1.html#br7139m.
As we see below, only a subset of regressors (in case, [y1(t-2), u1(t-1)]) are input to nonlinear function
M5 = NLARX(estData, [2 2 1], wavenet('Num',5), 'nlr', [2 3],'Focus', 'prediction', 'Display', 'on')
NL = M5.Nonlinearity; NL.Parameters; r = NL.Parameters.RegressorMean; Q=NL.Parameters.NonLinearSubspace; P=NL.Parameters.LinearSubspace; L=NL.Parameters.LinearCoef; as=NL.Parameters.ScalingCoef; aw=NL.Parameters.WaveletCoef; bs=NL.Parameters.ScalingDilation; bw=NL.Parameters.WaveletDilation; cs=NL.Parameters.ScalingTranslation; cw=NL.Parameters.WaveletTranslation; d = NL.Parameters.OutputOffset;
Where am I wrong?
x = [estData.y(1),0,estData.u(1),0]; %regressor(y(t-1) y(t-2) u(t-1) u(t-2)) values that are input in the linear function at t=1.
xnln = [0,0,estData.u(1),0]; %regressor(y(t-2) u(t-1)) values that are input in the nonlinear function at t=1.
% Compute the linear portion of the response (plus offset):
yLinear = (x-r)*P*L+d;
% Compute the nonlinear portion of the response:
f = @(z)(exp(-0.5*z'*z));%scale function (father wavelet)
yNonlinear1 = 0;
for k = 1:length(cs)
finputS = (bs*(xnln-r))*Q - cs(k);
yNonlinear1 = yNonlinear1 + as*f(finputS);
end
g = @(zz)((length(zz)-zz'*zz))*(exp(-0.5*zz'*zz));%wavelet function ("Mexican hat" mother wavelet)
yNonlinear2 = 0;
for k = 1:length(aw)
finputW = (bw(k,:)*(xnln-r))*Q - cw(k);
yNonlinear2 = yNonlinear2 +aw(k)*g(finputW);
end
% Total response y = F(x) = yLinear + yNonlinear1 + yNonlinear2
y = yNonlinear1 + yNonlinear2 + yLinear
In this case, i got the following response: y =
0.1126 0.1127
0.1127 0.1128
I would have to obtain a real number, is not it? the results obtained from the above steps must be equal to evaluate(NL,x)
Thanks
0 Comments
Accepted Answer
Rajiv Singh
on 5 Mar 2011
In the f(0 and g() formulas you need an inner product.
In your formula for f(), replace z'*z by z*z'. In the formula for g(), replace zz'*zz by zz*zz'.
This was a typo in the doc some time ago, now fixed. The online documentation shows the correct formula.
Rajiv
3 Comments
Rajiv Singh
on 6 Mar 2011
The paper uses a different notation for a regressor "vector" as MATLAB. In MATLAB, the regressors for one time value are represented as a row vector (reserving the row dim for different time values, as in common practice for most time dependent data) while in the literature, a column vector is used.
For the wavelet network formulation used, see:
Juditsky, A., H. Hjalmarsson, A. Benveniste, B. Delyon, L. Ljung, J. Sjöberg, and Q. Zhang, "Nonlinear Black-Box Models in System Identification: Mathematical Foundations." Automatica. Vol. 31, Issue 12, 1995, pp. 1725–1750.
More Answers (0)
See Also
Categories
Find more on Electrical Block Libraries in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!