input and feedback delay in narxnet
Show older comments
if true
% code
endHello,
I have recently started working on neural network with MATLAB. I am dealing with gas turbine dynamic model and facing problems in determining optimal value of input and feedback delays. I have gone through similar posts that suggests to look for target auto-correlation and input target cross-correlation but I am unable to read the graph to determine delays.I am attaching the graph for target auto-correlation and input target cross-correlation along with the code.(Code is taken from one of the example given for simplenarx data)
close all, clear all, clc,
tic
plt=0;
%[X,T] = simplenarx_dataset; % simplenarx_dataset;
load GT_complete.dat %data
FuelFlowLhr = GT_complete(:,12);
N1RPM = GT_complete(:,15);
x_1 = FuelFlowLhr(150:800,:);
t_1 = N1RPM(150:800,:);
X1 = x_1';
T1 = t_1';
X = con2seq(X1);
T = con2seq(T1);
x = cell2mat(X);
t = cell2mat(T);
[ I N ] = size(x); % [ 1 651 ]
[ O N ] = size(t); % [ 1 651 ]
% Define data for training
Ntrn = N-2*round(0.15*N) % Default 0.7/0.15/0.15 trn/val/tst ratios
trnind = 1:Ntrn;
Ttrn = T(trnind);
Ntrneq = prod(size(Ttrn)) % Product of element
MSE00 = var(t',1) % 0.1021
% Calculate Z-Score for input (x) and target (t)
zx = zscore(x, 1);
zt = zscore(t, 1);
zxtrn = zscore(x(trnind), 1);
zttrn = zscore(t(trnind), 1);
% Plot Input & Output for both original and transformed (Z-scored)
plt = plt+1,figure(plt);
subplot(221)
plot(x)
title('Fuelflow INPUT SERIES')
subplot(222)
plot(zx)
title('STANDARDIZED INPUT SERIES')
subplot(223)
plot(t)
title('RPM OUTPUT SERIES')
subplot(224)
plot(zt)
title('STANDARDIZED OUTPUT SERIES')
rng('default')
L = floor(0.95*(2*N-1))
for i = 1:1000 % Number of repetations to use for estimating summary statistics
% This is for Target (T) Autocorrelation
n = zscore(randn(1,N),1);
autocorrn = nncorr( n,n, N-1, 'biased');
sortabsautocorrn = sort(abs(autocorrn));
thresh95T(i) = sortabsautocorrn(L);
% This is for Input-Target (IT) Crosscorelation
nx = zscore(randn(1,N),1);
nt = zscore(randn(1,N),1);
autocorrnIT = nncorr( nx,nt, N-1, 'biased');
sortabsautocorrnIT = sort(abs(autocorrnIT));
thresh95IT(i) = sortabsautocorrnIT(L);
end
% For Target Autocorrelation
sigTthresh95 = median(thresh95T)
meanTthresh95 = mean(thresh95T)
minTthresh95 = min(thresh95T)
medTthresh95 = median(thresh95T)
stdTthresh95 = std(thresh95T)
maxTthresh95 = max(thresh95T)
% For Input-Target Autocorrelation
sigITthresh95 = median(thresh95IT)
meanITthresh95 = mean(thresh95IT)
mintIThresh95 = min(thresh95IT)
medtIThresh95 = median(thresh95IT)
stdtIThresh95 = std(thresh95IT)
maxtIThresh95 = max(thresh95IT)
%%CORRELATIONS
%%%%%TARGET AUTOCORRELATION %%%%%%%
%
autocorrt = nncorr(zttrn,zttrn,Ntrn-1,'biased');
sigflag95 = -1+ find(abs(autocorrt(Ntrn:2*Ntrn-1))>=sigTthresh95);
sigflag95(sigflag95==0)=[];
%
plt = plt+1, figure(plt);
hold on
plot(0:Ntrn-1, -sigTthresh95*ones(1,Ntrn),'b--')
plot(0:Ntrn-1, zeros(1,Ntrn),'k')
plot(0:Ntrn-1, sigTthresh95*ones(1,Ntrn),'b--')
plot(0:Ntrn-1, autocorrt(Ntrn:2*Ntrn-1))
plot(sigflag95,autocorrt(Ntrn+sigflag95),'ro')
title('SIGNIFICANT TARGET AUTOCORRELATIONS (FD)')
%
%%%%%%INPUT-TARGET CROSSCORRELATION %%%%%%
%
crosscorrxt = nncorr(zxtrn,zttrn,Ntrn-1,'biased');
sigilag95 = -1 + find(abs(crosscorrxt(Ntrn:2*Ntrn-1))>=sigITthresh95)
plt = plt+1, figure(plt);
hold on
plot(0:Ntrn-1, -sigITthresh95*ones(1,Ntrn),'b--')
plot(0:Ntrn-1, zeros(1,Ntrn),'k')
plot(0:Ntrn-1, sigITthresh95*ones(1,Ntrn),'b--')
plot(0:Ntrn-1, crosscorrxt(Ntrn:2*Ntrn-1))
plot(sigilag95,crosscorrxt(Ntrn+sigilag95),'ro')
title('SIGNIFICANT INPUT-TARGET CROSSCORRELATIONS (ID)')
Accepted Answer
More Answers (0)
Categories
Find more on Axis Labels 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!