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
93 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Paul
2023-7-29
编辑:Paul
2023-7-29
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 个)
Sam Chak
2023-7-29
编辑:Sam Chak
2023-7-29
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')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!