Prepare dataset for Neural State Space to be used as StateFcn in nlmpc
조회 수: 10 (최근 30일)
이전 댓글 표시
Hello,
I am trying to use the neural networks using the Neural State Space Models in MATLAB to be used as a state function in nonlinear mpc toolbox. During the training and validation process I want to use normalize data of the dataset to yield a generalizable data. However, I am not sure how to denormalize the data once the training and validation have been conducted. Can anyone one help me with this?
Thank you in advance.
댓글 수: 3
채택된 답변
Arkadiy Turevskiy
2023년 11월 27일
Thanks for posting the code.
To de-normalize the data you need to save mean and standard deviation data used for normalization.
[TdataN,C,S]=normalize(Tdata);
% now train neural state space, use it to predict normalized data PdataN
% using sim
% Now you can "de-normalize"
Pdata=PdataN.*S+C;
HTH
Arkadiy
댓글 수: 5
Arkadiy Turevskiy
2023년 11월 30일
Hi,
In your case it looks like the outputs (same as states) are the last 9 columns of TTdata, right?
So the bias and standard deviation info you need are in the last 9 columns of C and S in my code snippet in the answer.
Take those and use to denormalize your state derivatives/states/outputs as needed.
[TTdataN,C,S]=normalize(TTdata);
% your code to train neural state space model goes here
% you compute state derivatives dxdt1 as in your code above
% Now you can "de-normalize" state derivaties
% The code below assumes TTdata has 12 columns, the first 3 columns are
% inputs, and the last 9 are states/outputs
Cstate=C(4:length(C));
Sstate=S(4:length(S));
dxdt1_denormalized=dxdt1.*Sstate+Cstate;
Hth
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Plant Specification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!