MATLAB: How to make a model to realize a transfer function with time variant coefficient on Simulink

functionsimulinktimetransfervariant

How can I make a model to realize a transfer function with time variant coefficient on Simulink?

Best Answer

I introduce the following 2 methods.
1. Convert transfer function to state space representation
2. Use S-function
 
I explain with a given strictly proper first order transfer function in continuous system.
Give The coefficients d0 of the transfer function in equation A is time variant.
      n0
G(s) = ------------ ・・・(A)
    d1 s + d0
You can get the sample model (tvtfsamp.mdl) from the top of Answer column.
 
1. Convert transfer function to state space representation
First, assume n0, d1, d0 in equation A as time invariant, and convert the transfer function to state space representation.
Second, make a model of the converted state space equation and set the coefficients n0, d0, d1 as time variant.
Supporse each initial condition as zero.
 
*2. *Use S-function
You can get demo model of S-Function 'stvctf.c' which gives time variant parameters to transfer function.
open_system('sfcndemo_stvctf');
If you use discrete transfer function model, Use 'stvdtf.c'.
 
Restrictions
1) Feed Input signal, numerator coefficients and denominator coefficients as a vector signal this series.
2) The length of numerator coefficients should be same as denominator coefficients. In the sample model,  numerator coefficients vector is gave as [0 n0] for the restriction.
3) The length of numerator coefficients should be same as denominator coefficients too in  block parameter. See the following.
 
Note,  the coefficients update timing is different between these two methods. 
In the S-Function, state space array of previous time step is used for response calculation and it causes delay.
When the timing affects model behavior, select first method.
 
Appendix
You can use the following blocks to achieve time variant discrete transfer function in MATLAB 7.0(R14) or later.
Note, another input method of input parameters is required for the block.
You can get sample model of this method too from the top of answer column.
Simulink
-> Additional Math & Discrete
-> Additional Discrete
->Transfer Fcn Direct Form II Time Varying