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
64 ビュー (過去 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!