# 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)
John le 29 Juil 2023
Commenté : John le 1 Août 2023
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
##### 0 commentairesAfficher -2 commentaires plus anciensMasquer -2 commentaires plus anciens

Connectez-vous pour commenter.

### 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.
##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
John le 1 Août 2023

Connectez-vous pour commenter.

### Plus de réponses (1)

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);
subplot(311)
plot(t, s1, 'linewidth', 3, 'color', '#7c98c3'), grid on, ylim([-0.50 1.50]), ylabel('s_{1}')
subplot(312)
plot(t, s2, 'linewidth', 3, 'color', '#e5ab45'), grid on, ylim([-0.50 1.50]), ylabel('s_{2}')
subplot(313)
plot(t, p, 'linewidth', 3, 'color', '#abc564'), grid on, ylim([-0.05 0.15]), ylabel('p'), xlabel('t') ##### 1 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
John le 1 Août 2023
wonderful great thanks

Connectez-vous pour commenter.

### Catégories

En savoir plus sur Sources dans Help Center et File Exchange

### Community Treasure Hunt

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

Start Hunting!