# NARXNET closed-loop vs open-loop

I have three questions regarding the difference between a closed-loop and an open-loop narxnet, and it’s behavior.

First, a little about the problem I’m trying to solve. I have an 2xN dimensional **matrix** of observation (X), from which I’m trying to predict an output Y, 1xN. Now, a narxnet takes as input both X and Y. The Matlab documentation says that an open-loop narxnet finds a function ‘f’ where y(t) = f( y(t-1), y(t-2), x(t-1), x(t-2) ), for a delay of 2. However, the results that I get are much more accurate than I expect them to be. This suggests that the narxnet uses the actual y(t) as input as well. When I convert the open-loop to a closed-loop, and retrain it, I get much more reasonable results, not good, but reasonable.

1.a) What is the actual input to an open-loop narxnet, and the closed-loop. When trying to predict y(t), are the inputs [ y(t), y(t-1), y(t-2), x(t-1), x(t-2) ] or [ y(t-1), y(t-2), x(t-1), x(t-2) ], for both?

1.b) For my problem I need the inputs to be [ y(t-1), y(t-2), x(t), x(t-1), x(t-2) ], 0 to 2 delays on the X, and 1 to 2 delays on the Y. How can I do that?

2. For comparison, I’ve trained my open-loop, and tested it, then convert the open-loop to a closed-loop using

`netc = closeloop(net);`

then trained the closed-loop from scratch and tested it. I’ve read on MATLAB Answers that I should start training the closed-loop with the weights from the open-loop net. How can I used the weights of one net as the initial weights for training another?

3. I understand that the narxnet uses a combination of NNs and difference equations. I problem I run into when using a closed-loop narxnet is that my predictions begin to oscillate and explode exponential. I know that this problem occurs in a difference equation, such as y(t)=a*y(t-1)+b, when ‘a’ is greater than 1. What, in a closed-loop narxnet could cause this similar issue?

I didn’t include any code because my questions need high-level understanding and explanations, which I am lacking.

# ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

`% NARXNET closed-loop vs open-loop`

% Asked by Yevgeniy Arabadzhi

% 8:38 PM Thursday, November 3, 2016

%

% I have three questions regarding the difference between

% a closed-loop and an open-loop narxnet, and it's behavior.

%

% First, a little about the problem I'm trying to solve. I

% have an 2xN dimensional matrix of observation (X), from

% which I'm trying to predict an output Y, 1xN. Now, a

% narxnet takes as input both X and Y. The Matlab

% documentation says that an open-loop narxnet finds a

% function 'f' where y(t) = f( y(t-1), y(t-2), x(t-1),

% x(t-2) ), for a delay of 2.

What you are overlooking is the role of the target; In fact, you never mention the target!

The target is used to design and operate the OL net. To emphasize this point I prefer to use the following notation:

`Uppercase for cells`

Lowercase for doubles and integers

X,x for inputs

T,t for targets

Y,y for outputs

i,j for timestep indices

% However, the results that I % get are much more accurate than I expect them to be. % This suggests that the narxnet uses the actual y(t) % as input as well.

ABSOLUTELY NOT! You just happened to have an easy problem (which you did not identify!). There are a variety of sample datasets in the help and doc **documentations**. Use the commands

`help nndatasets`

doc nndatsets

% When I convert the open-loop to a closed-loop, and retrain it, % I get much more reasonable results, not good, but reasonable.

**SEE COMPLETE ANSWER CLICK THE LINK**

https://www.matlabsolutions.com/resources/narxnet-closed-loop-vs-open-loop.php