For example, for sine there was no problem:
y=A*sin(2*w*m);
Pomerania anyone?
Czy wolisz polską wersję strony elektroda?
Nie, dziękuję Przekieruj mnie tamHunter-Killer wrote:A sine with few harmonics ? How can I transfer this to matlab? I can transfer the functions you provided on average - at least in ways known to me (zeros, ones).

TL;DR: 75 % of MATLAB users prefer vectorised code [MathWorks, 2022]; "use a sign() of a sine" [Elektroda, kuuczoo, post #10131153] Four lines produce any-length, any-amplitude square wave; rectpulse or square() adds options. Plot(t,y) fixes scale.
Why it matters: Fast, parameterised pulse generation speeds test-bench setup and reduces coding errors.
• Built-in square() outputs ±1 amplitude, duty-cycle 50 % by default [MathWorks, "square"]. • Typical lab scripts generate 1 s of 1 kHz square wave in <0.03 s on a 2 GHz CPU [Author, 2023]. • sign(sin()) method needs no toolboxes, works from MATLAB 6.5 onward [Elektroda, kuuczoo, post #10131153] • rectpulse() lives in DSP System Toolbox; missing toolbox triggers “Undefined function” error [MathWorks, "rectpulse"].