Hello: i want to give a step input to my simulink function which starts at 1 second and ends at 1.1 seconds and having an amplitude of 0.1. Step block not working

23 vues (au cours des 30 derniers jours)
which block to be used for giving input to a function with a delay of few seconds, as step input block in sources is not giving the delay

Réponse acceptée

Paul le 29 Juil 2023
Modifié(e) : Paul le 29 Juil 2023
Try using the Waveform Generator block with Waveform Definition parameter set to pulse with appropriate parameters. However, the Waveform Generator block does not accept a continuous sample time.
If you need the pulse to have continuous sample time, then you can use two step blocks. Set the 'Final value' of each to 0.1. Set the start time of the first to 1. Set the start time of the second to 1.1. Use a Subtract block to subtract the second from the first. The output of the Subtract should be the desired rectangular pulse.

Plus de réponses (1)

Sam Chak
Sam Chak le 29 Juil 2023
Modifié(e) : Sam Chak le 29 Juil 2023
Hi @John,
Mathematically, the functions looks like this:
where a is the amplitude. So, you just need to construct the blocks accordingly.
Edit: Like what @Paul described the steps above, now you can visualize how the function is mathematically constructed.
t = linspace(0, 2, 20001);
a = 0.1; % amplitude
ton = 1.0; % on time
toff = 1.1; % off time
s1 = heaviside(t - ton);
s2 = heaviside(t - toff);
p = a*(s1 - s2);
plot(t, s1, 'linewidth', 3, 'color', '#7c98c3'), grid on, ylim([-0.50 1.50]), ylabel('s_{1}')
plot(t, s2, 'linewidth', 3, 'color', '#e5ab45'), grid on, ylim([-0.50 1.50]), ylabel('s_{2}')
plot(t, p, 'linewidth', 3, 'color', '#abc564'), grid on, ylim([-0.05 0.15]), ylabel('p'), xlabel('t')

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by