Simulated and predicted response of time-series idnlgrey model in Matlab

3 次查看(过去 30 天)
I have build an idnlgrey (nonlinear grey box) model using time-series dataset, and the model structure is an ODE system including two coupled ODEs, so it has two outputs y = [y1 y2].
On the one hand, I use sim() command to generate simulated response of model, and since time-series data has no inputs, only Initial Conditions will be used to compute simulated response, i.e. y_sim(t+1) = f(y(0)). For my understanding, the simulation procedure is actually to solve the ODE system using some numerical solvers. But I solve the ODE system using the most general solver ode45(), and compare with the simulated response from sim(). Although the fitness is high to 95%, but it means there exists error between sim() results and ode45() results. So I am wondering how sim() solves differential equations.
On the other hand, I use compare() command to generate k-step-ahead predicted response, which uses both Initial conditions and previous output data, but no matter values of kstep, it will generate same results with simulated data from sim(). I am wondering if time-series dataset displays same simulated and predicted response?
Ang suggestion is welcome!

采纳的回答

Rajiv Singh
Rajiv Singh 2022-7-18
IDNLGREY is an "output-error" model, that is, the noise affacts only the output measurements and not the state updates. Hence there is no difference between prediction and simulation.
sim() does indeed use a suite of ODE solvers, but they are not the same as MATLAB's built-in solvers. So small differences can arise.Use the "SimulationOptions" property of the idnlgrey model to configure the choice of solver and its settings.You can compare these settings against those used by MATLAB's ODE45 etc.
  2 个评论
Ying Wu
Ying Wu 2022-7-18
Hi Rajiv, thanks for your clarification about IDNLGREY and sim() command!
Now I have another question about the parameters estimation procedure of IDNLGREY.
My state-space model has four equations, four states x=[x1, x2, x3, x4], two output y1=x1 and y2=x3, and no input signal (time-series type). The measured time-series dataset (z) has 100,000 samples for time=0.01-1000 with Ts=0.01.
First, I build an initial IDNLGREY model (nlgr0) with given initial parametes p0 (9 of 15 are free). And I use the first sample of dataset, i.e. x0=[x1(0.01), x2(0.01), x3(0.01), x4(0.01)], as initial states which are all free.
Then, I check the performance of nlgr0 fitting to a partial dataset, ze=z(60,001:end). In order to match compare() result and measured data, I specify the InitialCondition of compare() as the states at start time of ze, so the code can be written as:
xf = [x1(60001) x2(60001) x3(60001) x4(60001)]'
opt = compareOptions('InitialCondition', xf);
compare(ze, nlgr0, opt);
nlgr0 has good performance of more than 80% for two outputs.
Next, I use nlgreyest() to estimate free parameters and states in nlgr0. I try two algrithoms and other defaults settings:
  • lsqnonlin: Trust-Region Reflective Newton
  • fmincon: SQP
But the estimated model (orange line) is no better than initial model (blue line) fitting to measured data (grey line). And the results from fmincon look like:
Do you know why this weried thing happens? Is there something wrong during the set-up of initial model or the estimation configuration of free parameter and states?
I am appreciated for any suggestion!
Rajiv Singh
Rajiv Singh 2022-8-9
Hard to say without lookin at the data you used for training, but I will speculate. The data that you used for traininng probably starts at a different time instant than what you use in compare() for initial states.

请先登录,再进行评论。

更多回答(0 个)

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by