How to generate one square pulse?

38 views (last 30 days)
Moamen Keshk
Moamen Keshk on 23 Nov 2020
Answered: Star Strider on 23 Nov 2020
How to generate one square pulse like this one in the picture, where I need to save the pulse in an array

Answers (1)

Star Strider
Star Strider on 23 Nov 2020
Try this:
sqpuls = @(t,t1,t2) (t>= t1) & (t <= t2);
t = linspace(-1, 1);
figure
plot(t, sqpuls(t, -0.5, 0.5), '-r')
grid
ylim(ylim*1.1)
Experiment to get the result you want.

Categories

Find more on Programming 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!