how to write a discrete function for grey-box
1 view (last 30 days)
Show older comments
Hi there...
i have a model regressory like below that i want to put it in my "m-file.m" as a function of idnlgrey command.
midnlgrey = idnlgrey(m-file.m,de)
my regresory model is :
y1(t) = 0.33*u2(t)*x1(t-1)^(1.34)+1.82*u1(t)+-0.01*u3(t)*u2(t)+1.3*x2(t-2);
y2(t) = 0.6*u2(t)-0.16*x1(t-1)^(9/8)+x2(t-1);
y3(t) = 1.65*u3(t)+3*u2(t-1)^2+u3(t-2)+7*u2(t-2);
how can i write above regressory equations as discrete function for idnlgrey command.
thank you
0 Comments
Answers (1)
Walter Roberson
on 2 Dec 2015
midnlgrey = idnlgrey('m_file', de)
You do not need to specify the '.m' extension
Notice that I renamed m-file.m to m_file.m . The name needs to be the name of a function and "-" is not permitted in the name of MATLAB functions.
The file m_file.m would have to start with
function [dx, y] = m_file(t,x,u,p1,p2, ...,pN)
where the number of p* arguments depends upon the number of parameters you need.
I cannot tell at the moment which of your u1, u2, u3, x1, x2, x3 are intended to be inputs, and which are intended to be states, and which are intended to be functions so I will not suggest the code for your m_file.m at this time.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!