Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NARX Neural Network

Status
Not open for further replies.

jbausano

Materials
Aug 12, 2004
1
Hello all,
I've started using the Neural Network toolbox V5.0 and got stuck... I followed the documentation for the "NARX Network" and got the example to work, not hard to copy/paste. Now I'm trying to figure out how I would add another input to this model, say I'd need to input, position, voltage and now temperature, just as an example. I've tried to modify the code but keep erros about the size of the inputs... could someone help me figure out this one? I've pasted the documentation example below for reference.

thanks... John
Virginia Tech

"""
clear all;close all;

load magdata
[u,us] = mapminmax(u);
[y,ys] = mapminmax(y);
y = con2seq(y); u = con2seq(u);
p = [u(3:end);y(3:end)]; t = y(3:end);

d1 = [1:2];
d2 = [1:2];
narx_net = newnarxsp({[-1 1],[-1 1]},d1,d2,[10 1],{'tansig','purelin'});
narx_net.trainFcn = 'trainbr';
narx_net.trainParam.show = 10;
narx_net.trainParam.epochs = 600;

for k=1:2,
Pi{1,k}=u{k};
end
for k=1:2,
Pi{2,k}=y{k};
end
narx_net = train(narx_net,p,t,Pi);

yp = sim(narx_net,p,Pi);
e = cell2mat(yp)-cell2mat(t);
plot(e)
"""
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor