NARX - 2hr Prediction of Cargo Temperature on transit
Show older comments
Hi Everyone,
NARX - 2hr Prediction of Cargo Temperature on transit
Pls help me out. I have experimental data for cargo temperature that I want to predict and visualize them as in a plotted graph form and have a model that will produce such when feed with different data at any point. I am struggling. I need your help
This is my code
clc clear all %% Data Import % % borderdelaysinputs - input time series. % borderdelaysoutputs_5_4tiers - feedback time series. load 'C:\Users\modelling\borderdelaysdata_5_4tiers' X = tonndata(borderdelaysinputs,false,false); T = tonndata(borderdelaysoutputs_5_4tiers,false,false);
%% Training Function trainFcn = 'trainlm'; % Levenberg-Marquardt
% Create a Nonlinear Autoregressive Network with External Input inputDelays = 1:2; feedbackDelays = 1:2; hiddenLayerSize = 10; net = narxnet(inputDelays,feedbackDelays,hiddenLayerSize,'open',trainFcn);
% Prepare the Data for Training and Simulation
[x,xi,ai,t] = preparets(net,X,{},T);
% Setup Division of Data for Training, Validation, Testing net.divideParam.trainRatio = 70/100; net.divideParam.valRatio = 15/100; net.divideParam.testRatio = 15/100;
% Train the Network [net,tr] = train(net,x,t,xi,ai);
% Test the Network y = net(x,xi,ai); e = gsubtract(t,y); performance = perform(net,t,y)
% View the Network view(net)
%% Plots % Uncomment these lines to enable various plots. %figure, plotperform(tr) %figure, plottrainstate(tr) %figure, plotregression(t,y) %figure, plotresponse(t,y) %figure, ploterrcorr(e) %figure, plotinerrcorr(x,e)
% Closed Loop Network netc = closeloop(net); netc.name = [net.name ' - Closed Loop']; view(netc) [xc,xic,aic,tc] = preparets(netc,X,{},T); yc = netc(xc,xic,aic); closedLoopPerformance = perform(netc,tc,yc)
% Step-Ahead Prediction Network nets = removedelay(net); nets.name = [net.name ' - Predict One Step Ahead']; view(nets) [xs,xis,ais,ts] = preparets(nets,X,{},T); ys = nets(xs,xis,ais); stepAheadPerformance = perform(nets,ts,ys)
I have not been able to plot the graph neither generate a model. How can I go about it?
Thank you for your assistance
Accepted Answer
More Answers (0)
Categories
Find more on Deep Learning Toolbox 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!