How do I make a user-defined square wave generator in simulink model?
Show older comments
I want to make a user defined square wave generator for simulink model( instead of using pulse generator).
But I don't know which formula should I use. I am asking for help.
Thanks in advance.

Answers (1)
Hi @Rakib
Perhaps you can try this one:
tau = 20; % period of the square wave
Ts = tau/(2^10); % 2^10 samples per period
[u, t] = gensig('square', tau, 2*tau, Ts);
plot(t, u, 'linewidth', 1.5), grid, ylim([-1 2])
Categories
Find more on Simulink Coder 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!