Message Boards Message Boards

0
|
5366 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Colored variables in output

Posted 10 years ago

Hello, I just have a very, very large output of my nonlinear MIMO System which I want to transfer into state space model for my master thesis. Now I wonder if there is any possibility to colorize some variables for better viewable or an idea to split my xdot = f(x,u) to xdot = f(x) + B(x)*U to perform I/O feedback linearization.

Thanks!

POSTED BY: Kurt Alber
3 Replies

You could try to use Collect[] for sorting/splitting your equation

f[x] = a x1 + b x2 u + c u + x1 u
Collect[f[x], u]

I never heard about colorizing certain veriables in the output, sorry. You may use capital letters for marking them!?

POSTED BY: Fabian Wiek
Posted 10 years ago

Thanks for your reply!

I already tried it with Collect[], unfortunatly I have two input variables U = {F, p} and I dont know how to collect only those results containing U. Collecting F(x) is no issue, I set F and p to zero, but I relly don't know how to collect my Matrix B -> xdot = F(x)+B(x)U I somehow need to erase the other terms for collecting B, its too large for copy, paste it... Btw my system has order 8.

For any advice I would be very grateful

POSTED BY: Kurt Alber

You could try formatting with MakeBoxes (or maybe with Format). So here f[x,u] is the expression you type and the expression in the FullForm expression, but an InterpretationBox is used to specify the Output form of the expression. The InterpretationBox is applied to a List where the first expression gives the box formatting and the second expression gives the internal expression. (This is done because InterpretationBox has the Attribute HoldAllComplete and we may want to compute things to put in the first expression.) So, for example:

MakeBoxes[f[x_, u_], form : StandardForm | TraditionalForm] :=
 InterpretationBox[#1, #2] & @@ {StyleBox[
    ToBoxes[f[x] + B[x] Style[u, Red], form], 20, Bold], f[x, u]}
f[x, u]
% // FullForm 

You can turn off the formatting with:

MakeBoxes[f[x_, u_], form : StandardForm | TraditionalForm] =.
f[x, u]
Attachments:
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract