[Date Index]
[Thread Index]
[Author Index]
Re: Arranging input data (nonlinear control systems)
*To*: mathgroup at smc.vnet.net
*Subject*: [mg77628] Re: [mg77563] Arranging input data (nonlinear control systems)
*From*: anguzman at ing.uchile.cl
*Date*: Thu, 14 Jun 2007 05:21:14 -0400 (EDT)
*References*: <200706131124.HAA06679@smc.vnet.net>
Hello:
If Holding the definitions of Shift and PseudoD it\'s all you need,
you could give StateSpace the HoldFirst Atrribute:
SetAttributes[StateSpace, HoldFirst]
And then:
In[4]:=
StateSpace[{Shift[a_, t_]:= a/.t->t+1,
PseudoD[a_, t_]:= 0},f, Xt, 3+2, t, h, Yt]
Out[4]=
StateSpace[{Shift[a_,t_]:=a/.t->t+1,PseudoD[a_,t_]:=0},
f,Xt,5,t,h,Yt]
In this way, you carry the above \"StateSpace object\" without ever
actually evaluating the first argument. You can define Shift and
PseudoD extracting it from the StateSpace or using Evaluate
Hope this helps...
Atte. Andres Guzman
Maris To~nso <mtonso at staff.ttu.ee> ha escrito:
> Dear group,
>
> I am writing a Mathematica package dealing with nonlinear control systems.
> I have a problems with organizing input data. I try to describe my problem
> so that people, who are not aquainted with control systems theory, can
> understand, too.
>
>
> There are different types of nonlinear control systems.
>
>
> ____________1. Discrete system
>
> classical state equations are in the form
>
> x(t+1) = f(x(t),u(t)), (here f = (f1,f2,...) is nonlinear function)
> y(t) = h(x(t))
>
> for example,
>
> x1(t+1) = x1(t) + x2(t) u2(t)
> x2(t+1) = u1(t)
> y(t) = x1(t)
>
> So far I have entered and hold above system like this:
>
> f = {x1[t] + x2[t] u2[t], u1[t]};
> Xt = {x1[t], x2[t]};
> Ut = {u1[t], u2[t]};
> h = {x1[t]};
> Yt = {y[t]};
> dstateeqs = DStateSpace[f, Xt, Ut, t, h, Yt];
>
> The head DStateSpace indicates it is a discrete system and keeps the
> system data together. Now a user can apply package functions to the
> system, entering the single argument. For example,
>
>
> Observability[ dstateeqs ] (* checks observability *)
>
> ClassicStatesToIO[ dstateeqs ] (* finds input-output equations *)
>
> BookForm[ dstateeqs ] (* acts like TraditionalForm, i.e. prints the system
> in normal way x1[t+1] = ... *)
>
>
>
> __________2. Continuous system:
>
> classical state equations are in the form
>
> \dot x = f(x,u) (Here \dot x is time derivative)
> y = h(x)
>
> for example,
>
> \dot x1 = u1 + u2
> \dot x2 = x1*x2
> \dot x3 = x3
> y = x1 + x2
>
> So far I have entered and hold above system like this:
>
> f = {u1[t] + u2[t], x1[t]*x2[t], x3[t]};
> Xt = {x1[t], x2[t], x3[t]};
> Ut = {u1[t], u2[t]};
> h = {x1[t] + x2[t]};
> Yt = {y[t]};
> cstateeqs = CStateSpace[f, Xt, Ut, t, h, Yt];
>
> Though continuous systems are traditionally written without time argument
> t, I have chosen to write it, to keep analogy with discrete case.
> CStateSpace indicates it is a continuous system. Package functions can be
> applied to it exactly like in discrete case.
>
> Observability[ cstateeqs ]
> ClassicStatesToIO[ cstateeqs ]
> BookForm[ cstateeqs ]
>
>
> The sysem worked quite properly and was easy to understand and use, but no
> a big trouble has appeared. My professor says there will be more cases
> than just discrete and continuous!
>
>
> __________3. General case:
>
> classical state equations have form
>
> x^<1> = f(x,u)
> y = h(x)
>
> here x^<1> (x with superscripted "<1>" ) is a changeable operator,
> depending on two functions: generalized shift and pseudoderivative. Of
> course, the general case covers discrete and continuous systems, if shift
> and pseudoderivative are chosen in a right way. Some examples:
>
> Discrete: Shift[a_, t_]:= a/.t->t+1; PseudoD[a_, t_]:= 0
> Continuous: Shift[a_, t_]:= a; PseudoD[a_, t_]:= Dt[a, t]
> Difference: Shift[a_, t_]:= a/.t->t+1; PseudoD[a_, t_]:= Shift[a,t]-=
a
> q-shift: Shift[a_, t_]:= a/.t->q*t; PseudoD[a_, t_]:= 0
> q-difference: Shift[a_, t_]:= a/.t->q*t; PseudoD[a_, t_]:= Shift[a,t]-=
a
> ... and there are more of them.
>
> Now, the the expression of state equations should carry also an
> information about shift and pseudoderivative operators. Something like
>
> StateSpace[f, Xt, Ut, t, h, Yt, Hold[{Shift[a_, t_]:= a/.t->t+1,
> PseudoD[a_, t_]:= 0]}]
>
> If I don't use Hold, it gives simply Null. Unfortunately, I have never
> seen a Mathematica function, which arguments should be entered with Hold.
>
> An alternative is to define two global variables Shift[a_,t_] and
> PseudoD[a_,t_]. I am bit afraid of global variables, because Mathemativa
> built-in functions and Standard packages use them really rarely.
>
> So, were should I put these shift and pseudoderivative?
>
>
> It is also clear classical discrete and continuous systems are used much
> more often than those other cases, so there should be an oportunity to
> enter these systems easily, without thinking about shifts and
> pseudoderivatives. So, I should probably keep the old heads DStateSpace
> and CStateSpace, too. Or would it be better to use complete words,
> something like
>
> StateSpace[f, Xt, Ut, t, h, Yt, "Discrete"] and
>
> StateSpace[f, Xt, Ut, t, h, Yt, "Continuous"] ?
>
>
> Thank you for reading. I am not expecting a complete solution, any ideas
> and hints would be helpful.
>
>
>
>
>
> Yours sincerely
> Maris T=F5nso
>
>
> --------------------------------------------------------
>
>
> Maris T=F5nso
> Control Systems Department
> Institute of Cybernetics at TUT
> Akadeemia tee 12, 12618
> Tallinn, Estonia
>
>
>
>
>
>
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Prev by Date:
**Re: Re: Re: simplification of 0/0 to**
Next by Date:
**default display of reals & last command behavior in terminal**
Previous by thread:
**Arranging input data (nonlinear control systems)**
Next by thread:
**Re: Arranging input data (nonlinear control systems)**
| |