Embedding a Neural Net
1 view (last 30 days)
Show older comments
I have a NARX model (see attached file for an illustration) to compute the voltage response of an electrical circuit. The output voltage y(t) is a result of both instantaneous and time-delayed effect of applied current x(t). Therefore, the input delay is setup to include the instantaneous value of x(t), along with past values.
I would like to set this up to operate one sample at a time in an infinite loop where the model output (voltage) is compared to the real-time measured voltage:
% Take analog-to-digital measurements of current and voltage
I_meas = current_measurement; % single measurement of current
V_meas = voltage_measurement; % single measurement of voltage
X = con2seq(I_meas); % convert to cell
% Now the neural network computes a single point of modeled voltage
Y_hat = net(X,Xi,Ai);
% Compute the difference between measurement and modeled result
V_hat = cell2mat(Y_hat); % convert back to variable
Model_Error = (V_meas - Y_hat);
repeat loop and take another sample;
How do I setup the net for this usage case?
2 Comments
Greg Heath
on 21 Feb 2015
Why in the world would you want to implement this one timestep at a time???
Since there is no such thing as an infinite loop, NEVER try to design a program that has any.
Answers (0)
See Also
Categories
Find more on Sequence and Numeric Feature Data Workflows in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!