PS: It seems to me that a STEPWISE QUASI-STATIC APPROXIMATOR to the CL (Closed Loop) NARXNET should be possible by using the function ADAPT (or even TRAIN?) in a loop that uses y(n-2:n-1) to predict y(n).
What does the Tapped Delay Line (TDL) in NARX NN exactly do? 1- Does it sum the previous values (either input or target) and use as input? Because that's what I understood from the research I have made. This is a concept related to digital signal processing, and it is defined like so. 2- Does it input the previous values as individual points? This makes more sense to me, as this will keep more information in the data and should improve prediction ability. Thinking about it, is there a way to determine what we want, by coding? Because both methods could be useful under different circumstances.
John Williams answered .
2025-11-20
clear all, close all,clc, plt=0
[ INPUT TARGET ] = simplenarx_dataset;
input = cell2mat(INPUT);
target = cell2mat(TARGET);
[ I N ] = size(input) % [ 1 100 ]
[ O N ] = size(target) % [ 1 100 ]
plt = plt+1, figure(plt), hold on
plot( input, 'k', 'LineWidth', 2 )
plot( target, 'b', 'LineWidth', 2 )
net0 = narxnet(1:2,1:2,10); % default OL time-series configuration
net = fitnet(10); % static OL approximator
x = [ input(1:end-2);input(2:end-1); ...
target(1:end-2); target(2:end-1)];
t = target(3:end);
rng(4151941)
[ net tr y e ] = train(net,x,t );
NMSE = mse(e)/var(t',1) % 3.1731e-07
Rsq = 1 - NMSE % 1
plt = plt+1, figure(plt), hold on
plot( 1:N-2, x, 'k', 'LineWidth',2)
plot( 3:N, t, 'b', 'LineWidth',2)
plot( 3:N, y, 'ro', 'LineWidth',2)
legend('INPUT', 'TARGET','OUTPUT')