1
$\begingroup$

Suppose I have a transfer function defined via TransferFunctionModel, e.g. tf == TransferFunctionModel[{{1/s}}, s]. How can I perform operations on tf, e.g. multiplication. As an example, I may want to use it as follows RootLocusPlot[k tf, {k, 0, 10}] which does not work.

Is there a way to extract a transfer function model such that it can be modified, e.g. similar to the way Normal works for StateSpaceModel?

$\endgroup$
2
$\begingroup$

You Just use the tf, with no k multiplied in the call to RootLocusPlot.

The k goes to the tf it self. Like this

sys = TransferFunctionModel[k*(s^2 + 2 s + 4)/(s (s + 4)(s + 6)(s^2 + 1.4 s + 1)), s];
RootLocusPlot[sys, {k, 0, 100}, 
    ImageSize -> 300, 
    GridLines -> Automatic, 
    GridLinesStyle -> Dashed, Frame -> True, AspectRatio -> 1]

Mathematica graphics

Is there a way to extract a transfer function model such that it can be modified, e.g. similar to the way Normal works for StateSpaceModel

I am not sure what you mean. the tf, is the polynomial ratio in s you had at the start, so you have this allready. You can always go First@tf to get it again.

$\endgroup$
  • $\begingroup$ Is it always the case that tf == TransferFunctionModel[tf[[1, 1]]/tf[[1, 2]], s]? $\endgroup$ – Mathabc Jan 11 '15 at 22:26
  • $\begingroup$ Yes. transfer function, before passing it to Mathematica's TransferFunctionModel, is just ratio of 2 polynomials, like in the textbooks. So this is tf= k * N(s)/D(s), where N(s) is the numerator poly, and D(s) is the denominator poly. Now, you just do fancyTf=TransferFunctionModel[tf] only to be able to use fancyTf as a Mathematica transfer model. Since mathematica only knows it inside this wrapper. (ps. you should use == in the above, it is just =, a normal assignment) $\endgroup$ – Nasser Jan 11 '15 at 22:30
1
$\begingroup$

You can do this with the mathematica model connections. For the full list see http://reference.wolfram.com/language/guide/ModelConnections.html

For example using the function SystemsModelSeriesConnect:

tf = TransferFunctionModel[{{1/s}}, s];

SystemsModelSeriesConnect[TransferFunctionModel[k, s], tf]

Output is the gain, k multiplied by the original transfer function. You can do more complex multiplications and parallel combinations, feedback arrangements, etc. with the various connections.

$\endgroup$
0
$\begingroup$

You could try this:

tf = TransferFunctionModel[{{1/s}}, s]
ClearAttributes[Times, Protected];
Times[k_, TransferFunctionModel[m_, s_]] := 
    TransferFunctionModel[k m, s]
SetAttributes[Times, Protected];

But you would have to modify a lot of operations.

$\endgroup$
  • $\begingroup$ Not feasible, IMO, because fundamental arithmetic operations are subject to special optimizations and can fail to apply (or lose completely) their user-defined rules at any moment. It would be better to make this definition on TransferFunctionModel than Times. $\endgroup$ – Oleksandr R. Jan 12 '15 at 12:04
  • $\begingroup$ I tried that but got some complaints about a tag being nested too deep... $\endgroup$ – bdforbes Jan 12 '15 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.