How to add an s+1 block on simulink?
39 views (last 30 days)
Show older comments
Hi everyone, I'm new to Simulink and had a quick question.
How do I add a block that says "s+1" on Simulink? I tried adding a transfer function with numerator [1 1] and denominator [1] but it won't let me do that. I understand s+1 is a lead/lag filter, but Simulink's transfer function lead/lag doesn't seem to match what I need. Any pointers would be much appreciated. Thanks!
4 Comments
Mathieu NOE
on 22 Nov 2024
s is a derivation, so s + 1 can be replaced by a derivative block in parallel to a unitary gain block , followed by a sum block
Paul
on 22 Nov 2024
If using the Derivative block, be sure to read the doc page first and carefully review its recommendations and warnings.
Answers (2)
Sam Chak
on 22 Nov 2024
Edited: Sam Chak
on 23 Nov 2024
Hi @Julian
Since you are unable to clearly define the control objective and performance requirements, I can only advise you to use the PD controller as a substitute for the '' (in the frequency domain), with a proportional gain and Derivative gain . However, there is a caveat in your design: it will only function properly as long as . No mathematical proof is provided in my response though.
Note: Please remember to disable the zero-crossing detection in the Sign block. This is a software technical issue, not a sliding mode control mathematics issue.
4 Comments
Paul
on 23 Nov 2024
Hi Sam,
Becasue the OP is interested in the phase portrait with zero input, my inclination would be to implement the system like this wiht IC's on the second order integrator in the plant.
Next, I was thinking about a basic describing function analysis to determine if the loop is stable, but I can't recall if describing function analysis can be used when the loop transfer function has a pole in the RHP, as is the case here. I would try do some sort of analysis first to at least get a qualitative idea as to what might happen for different IC's and then simulate, at which point it might be clearer if zero-crossing detection is needed or not to get an accurate result.
Rahul
on 22 Nov 2024
I understand that you are trying to implement a continuous transfer function ‘s+1’ in Simulink, where you are getting an error stating the given transfer function is an improper transfer function. the order of the transfer function numerator polynomial must be smaller than the degree of the denominator polynomial
You can try to add a MATLAB function to simulate the effect of (s) as a derivative and add 1, since Simulink operates in the time domain.
function y = transfer_func(u)
% Transfer function implementation: (s + 1)
persistent prev_u prev_y
if isempty(prev_u)
prev_u = 0;
prev_y = 0;
end
% Compute derivative term (approximation)
sample_time = 0.01; % Replace with your Simulink fixed-step size if known
du = (u - prev_u) / sample_time;
% Compute output
y = du + u; % s * u + 1 * u
% Update persistent states
prev_u = u;
end
I tried to simulate the given MATLAB function on a model containing a signal generator block, like sine wave, and then visualized the output in a scope block. Here’s the model structure along with the final output waveform:
This approach simulates the (s) operation by computing a numerical derivative using a simple difference quotient, and then adds 1 to the result. You can adjust the ‘dt’ value to match your system's sample time for accurate results.
To know more about the usage of ‘persistent’ variables, enter the following command in MATLAB:
>> doc persistent
Hope this helps!
0 Comments
See Also
Categories
Find more on Classical Control Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!