Possibility of Custom Denominator of Transfer Function within Simulink
7 views (last 30 days)
Show older comments
Alexander Gaudreau
on 30 Sep 2024
Commented: Alexander Gaudreau
on 30 Sep 2024
I'm trying to replicate a part of a block diagram and I'm unable to use a normal transfer function block as it only accepts the input signal, and not a varying time constant such as tau_D. I know that I can use a function block and create a code to accept both the input signal and the time varying variable. However, within simulink I'm not able to use the "tf" function as it not supported. I apply state space method, and while the results are within 1-2 Hp, I'm not happy with the time response of the engine ramping up to the desired HP number (See display and scope). It also doesn't start at zero. When I uncomment the rest of the diagram to verify how it integrates with the other blocks within the block diagram, the function block produces the following error:
"Derivative of state '1' in block 'Question_Variable_Transfer_Function/Integrator' at time 0.0 is not finite. The simulation will be stopped. There may be a singularity in the solution. If not, try reducing the step size (either by reducing the fixed step size or by tightening the error tolerances)"
Essentially, it boils down too two questions:
1.) Is there a block or a function that allows a variable time constant (tau_D) to be inputted into the denominator of the transfer function of the transfer function?
2.) Apart from changing the fixed step size, is there any other way to remove the error simulink is presenting.
I appreciate any guidance or help to mitigate this issue? Thanks in advance.
Accepted Answer
Sam Chak
on 30 Sep 2024
For a variable gain in a dynamic model, you can try describing the system using MATLAB Function block.
%% MATLAB Function block
function dx = odefcn(x, u, tauD)
A = - 1/tauD;
B = 1/tauD;
dx = A*x + B*u;
end
Else, you can trying using the LPV System block. LPV stands for "linear parameter-varying".
For a variable gain , you can use the Divide block where you should feed the signal to the division port (2nd input port).
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!